f.- AnovaF1F2.fnc

Objetive

In those experiments in which a certain number of subjects undergo J or JxK experimental repeated measures conditions and in each condition subjects receive a number i of items. It is usual estimate the design effects with the subjects as a unit (subjects analysis), the items as a unit (items analysis) and finally analyse the effect on subjects and items simultaneously (minf).

The function Anova.F1F2.fnc run this analyses in a sequentially way.

  1. We must remember that the analysis F1 (by subject) give us the generalizability of the results assuming another random sample of subjects who are passed exactly the same items as the parent sample.

  2. F2 analysis (for items), does the same but assuming another random sample from the population of items tested over the same subjects..

  3. Minf analysis (statistical lower limit F '(F premium) allows the simultaneous generalization of the fixed effects found over subject and items. However this increase in the simultaneous generalization over subjects and items it is carried out with a significant loss of power contrast.

The user can query mixed.model.fnc for a more powerful alternative to the analysis of such data.

F1, F2 y minF

We begin with the simulated database:

  1. experimento_F1F2.Rdata

  2. experimento_F1F2_errores.Rdata

This data base contains the responses (reaction time) and correct and incorrect responses (1 and 0) respectively from 30 subjects in 172 items in a nesting design of two repeated measures factors mrA and mrB 2 x 2 (43 items per condition).

dat=read.file.fnc('experimento_F1F2.Rdata')

*** The external file experimento_F1F2.Rdata has been correctly read. ***

*** This is it head:

The object is a matrix that belong to class: data.frame

and has 30 rows and 172 columns (variables)

Since we have repeated measures on multiple items we must stack the data. If we type head(dat) we will see that the names of the 172 variables range from X1 to X172.

Now we will read the database with the successes and mistakes of the 30 subjects in the 172 items.

error=read.file.fnc('experimento_F1F2_errores.Rdata')

*** The external file experimento_F1F2_errores.Rdata has been correctly read. ***

*** This is it head:

The object is a matrix that belong to class: data.frame

and has 30 rows and 172 columns (variables)

item1 item2 item3 item4 item5 item6 item7 item8 item9 item10

1 1 1 0 0 1 1 1 1 1 1

2 1 1 1 1 1 1 0 1 1 1

3 1 0 1 1 1 1 1 1 1 0

4 1 1 1 1 1 1 1 1 1 1

5 1 1 1 1 1 0 1 1 1 1

6 1 1 1 1 1 1 1 1 1 0

It is very important to remember that the reaction times with errors should be eliminated (make NA) and should be analyzed only for correct answers in the task. This will achieved first multiplying the reading time matrix by the error matrix. This will give us zero (0) for the times that correspond to errors. Secondly once the data is stacked we recode the variable dv that will contain the 30x172 matrix for the reaction times causing the zero values are equal to NA.

dat= dat*error

Before stack we must define the characteristics of our within factors design.

within.factor= list(mrA=c('low','hig'),

mrB=c('short','long'))

Now we can stack the data and get a manipulable matrix due to the fact that the 172 measures and the 30 subjects will now be in a single column name dv.

dat.st = stack.data.fnc(dat, within.factor=within.factor,

col.start.rm=1, n.item=172)

#------------------------------------------------------------------

# STACK DATA

#------------------------------------------------------------------

*** This is the head of stacked data: ***

dv item subject mrA mrB condition

1 631.94 item1 suj1 low short low.short

2 573.98 item1 suj2 low short low.short

3 553.66 item1 suj3 low short low.short

4 532.54 item1 suj4 low short low.short

5 624.92 item1 suj5 low short low.short

6 716.63 item1 suj6 low short low.short

It's time to recode the variable dv to make that the values for reading time equal to 0 are system-missing (NA) with recode function.

dat.st$dv= recode(dat.st$dv, " 0=NA ")

Or perhaps we can prefer this other way:

dat.st$dv= ifelse(dat.st$dv==0,yes=NA, no=dat.st$dv)

With the stacked data and errors times "eliminated" we must first carry out a preliminary exploratory analysis of the "behavior" of our dependent variable dv (reaction time) through the 4 experimental conditions. As we know a very useful tool is the histogram.

The data stack automatically created a new variable named condition. we can use it to observe the reaction time distribution (dv) in each experimental conditions.

histogram.fnc(dat.st, which.factor='condition')

histogram.fnc(dat.st, which.factor='condition', check=T)

Both histograms indicate us a significant amount of incorrect reaction time values ​​(less than 200 ms). In the experiments in which each condition consists of a certain number of items it is important to perform a “cleaning” of the measured variable (reaction time, EEG amplitude, etc.) within subjects and condition (4 cleanings per subject in our example).

The function clean.dv.fnc performs this task.

dat.cl=clean.dv.fnc(dat.st, dv='dv',

which.factor='condition', which.min=200)

histogram.fnc(dat.cl, which.factor='condition', check=T)

We ask for the cleaning of the dependent variable dv for each subject in the four levels of the factor condition. We further ask for that before cleaning make NA (missing) any value less than 200 ms. Assuming a default cleaning + -2 standard deviations about the mean.

cleaning descriptives

rt before cleaning

rt after cleaning

As you can see the function tells you that it has been cleaned using + - 2 standard deviations above the mean. Also tells you that before performing this cleaning had missing values ​​in the data matrix (previous.NA). This missing are those coming from an error that the subject commit. The cleaning function have made missing (NA) to 7.% Of values and also it tells you the frequency transformed value to NA for experimental condition.

In the figure to the right you can see clearly the cleaning process output. Obviously all time below 200 ms have disappeared and we seen clearly that the average for low.short and hig.short conditions obtain the longer times. It is perceived clearly a positive symmetry in the distribution of reaction times (values ​​are accumulated in the lowest values ​​of the variable) which on the other hand it is expected.

Now we are ready to carry out simultaneous estimation of our model ANOVA by subjects, items and minf with Anova.F1F2.fnc.

Anova.F1F2.fnc(dat.cl, within.factor=within.factor)

res.F1F2.minF

You can see that the interaction was significant (p <0.05) both by subject and by items, but not for the minf, which prevents us from generalizing the AxB effect on both populations (subjects and items). As an example let's assume that this interaction has also been significant and ask for the simple effects that we will obtain in an easy way adding the argument poshoc with the name of the estimated effect.

Anova.F1F2.fnc(dat.cl, within.factor=within.factor,

poshoc='mrA:mrB')

res.poshoc.f1f2

You can see a more powerful alternative for this experiment in mix.model where the desired significance for interaction is achieved.

Stacked data (items REPEATED design)

You can see, on page stack of data in the data section Stacking (REPEATED Designs items), an example of analysis of variance by subjects and items in the context of repeated-items in levels of a repeated measured factor.

Up->