panelplot.fnc

Copy, Paste and Adapts

panelplot.fnc(dat, dv=3, which.factor='A:B', by.panel='subject', regression=T)

panelplot.fnc(dat.ap, which.factor='hour:phase', by.panel='treatment:gender')

Objetive

It allows the subdivision of a graph of lines or points between the different levels of a factor. Frequently one graph per subject. Especially useful when we try to study the course of each subject through the conditions of repeated measurements. We can also subdivide the graph where each panel is a percentile level (quartiles) of a quantitative variable selected by the user.

Panel plot

On the stacked data of the OBrienKaiser data we will request different panel plots.

We want to see the average of the 5 hour measurements at each phase level for each participant. The argument by.panel will be used to indicate the variable on which we want to make the subdivisions of the graphs. In this case we indicate the subject variable.

1.- panelplot.fnc(dat.st, which.factor='phase',

by.panel='subject')

With the argument regression=T, we want to see the relationship between the dependent variable and the phase factor. The function estimates one linear and one non-linear model for each subject.

In case we don't want the points for each observation we must include the argument type=' ' (blank space)

2.-panelplot.fnc(dat.st, which.factor='phase',

by.panel='subject', regression=T)

2b.-panelplot.fnc(dat.st, which.factor='phase',

by.panel='subject', regression=T, type=' ')

In tre argument which.factor we now define the interaction phase x hour (phase:hour).

3.-panelplot.fnc(dat.st, which.factor='phase:hour',

by.panel='subject')

1.-

2.-

2b.-

3.-

If we want the above graph of the crossing of the two factors of repeated measurements phase x hour in each level of the intergroup factor treatment, we can achieve it quickly by including such "interaction" in the argument by.panel.

panelplot.fnc(dat.st, which.factor='phase:hour',

by.panel='gender:treatment')

La gráfica de panel es asimismo de gran utilidad cuando deseamos ver si la relación que existe entre dos variables está siendo modulada por una tercera variable cuantitativa (numérica). Para mostrar este uso, partiremos de la base de datos efi.bfi de la librería psych que contiene 13 variables medidas en 231 sujetos. Las 5 primeras provienen del inventario de personalidad de Eysenck, las 5 siguientes del cuestionario Big 5 (Acomodación, Conciencia, Extraversión, Neuroticismo y Apertura), bdi (depresión de Beck) y las dos últimas son medidas de Ansiedad rasgo-estado.

The panel plot is also very useful when we want to see if the relationship between two variables is being modulated by a third quantitative (numerical) variable. To show this use, we will start from the psych library's efi.bfi database, which contains 13 variables measured in 231 subjects. The first 5 come from Eysenck's personality inventory, the next 5 from the Big 5 questionnaire (Accommodation, Consciousness, Extraversion, Neuroticism and Opening), bdi (Beck's depression) and the last two are measures of trait-state Anxiety.

library(psych); data(epi.bfi)

?epi.bfi # Te informará sobre el contenido de la base de datos epi.bfi

var.names(epi.bfi)

name column type

1 epiE 1 integer

2 epiS 2 integer

3 epiImp 3 integer

4 epilie 4 integer

5 epiNeur 5 integer

6 bfagree 6 integer

7 bfcon 7 integer

8 bfext 8 integer

9 bfneur 9 integer

10 bfopen 10 integer

11 bdi 11 integer

12 traitanx 12 integer

13 stateanx 13 integer

As you can see all variables are integer. We are going to request initially the graph of correlations of all the variables in order to make contact with the relation that exists between the different measured variables.

correlationplot.fnc(epi.bfi)

We see a clear group of high correlation between the first 3 variables of the Eysenck questionnaire (extraversion, sociability and impulsivity). Another group is formed by 3 factors from the Big 5 questionnaire (bfagree (conformity), bfcon (acting according to one's own conscience) and bfext (extraversion). Finally we have the group formed by bdi (Beck's Depression Questionnaire) and the measures of anxiety trait and state.

We want to investigate whether the relationship between Extraversion and Sociability is modulated by the level of depression measured with the Beck Depression Questionnaire (bdi).

We will first create a quartile version of this variable.

epi.bfi=cut.variable.fnc(epi.bfi, variable='bdi',

ntiles=4)

The function will create a new nominal variable (bdi.r) with four levels (Q1 to Q4) relative to the four quartiles into which the variable bdi has been subdivided.

panelplot.fnc(epi.bfi, dv='epiE', which.factor='epiS',

by.panel='bdi.r')

panelplot.fnc(epi.bfi, dv='epiE', which.factor='epiS',

by.panel='bdi.r', regression=T)

Above all the right graph clearly shows that the relationship between Extraversion (epiE) and Sociability (epiS) is not modulated at all by the level of depression measured with the beck questionnaire (bdi). This modulating process can be studied from two points of view: the first and most evident one answers the question of whether the regression slope of Extroversion on Socialization is modified as the value of the depression variable measured with the BDI increases. The second refers to whether the Extroversion values accumulate in the low, medium or high zone as the depression values increase. The answer to the first is that we can assume a regression slope common to the four bdi quartiles and to the second that the Extraversion values do not seem to be substantially modified by the change in depression intensity.

Subir ->