Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I am analysing some behaviour data from several participants in Matlab. I used to do "repeated measures" in SPSS.

But is this the same as adding "subject" as a factor, and choosing it as a random effect?

i.e. my normal repeated measures data matrix x looks like this

                 condition A      condition B
subject 1          x(1,1)           x(1,2)
subject 2          x(2,1)           x(2,2)
...                 ...              ...
subject 7          x(7,1)           x(7,2)

so for Matlab, I tried

COND = [1 2                   SUBJ = [1 1
        1 2        and                2 2   
        ...                           ...
        1 2]                          7 7]

then ran

anovan(x(:), {COND(:), SUBJ(:)}, 'random',2 )

Now, this does not seem to give me the same results as SPSS, for repeated measures... Perhaps I have misunderstood the 'random' parameter - I thought you could construct a "repeated measures" test from it?

share|improve this question
Please do not cross-post here and on SO. – mbq Nov 28 '11 at 17:25
sorry @mbq, someone told me I should post here but didn't know how to migrate questions – Sanjay Manohar Nov 28 '11 at 17:35
Ok; for the future, you can ask mod to do this by flagging question. – mbq Nov 28 '11 at 17:38

1 Answer

up vote 3 down vote accepted

But is this the same as adding "subject" as a factor, and choosing it as a random effect? Yes. These two SPSS codes gives identical results for the RM-factor "cond":

/*Wide data structure: cond as 2 variables*/.
glm cond_A cond_B /wsfactor= cond 2 /wsdesign= cond.

/*Long data structure: dependent var score and factor cond with 2 levels*/.
glm score by cond subject /random= subject /design= cond subject.

I can't speak of MATLAB.

P.S. Long data structure is like this:

subject cond score
1       A    1.2
1       B    0.5
2       A    3.1
2       B    1.4
3       A    0.8
3       B    1.8
...
share|improve this answer
Thanks! That is helpful. But what about interaction terms e.g. cond x subject? should they included or excluded from the regression? The funny thing is matlab reports main effect of subject p<0.00001 - do I just discard this as irrelevant, or should I somehow stop matlab from making this contrast? – Sanjay Manohar Nov 29 '11 at 11:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.