How to correctly specify WithinDesign for fitrm

조회 수: 19 (최근 30일)
bethel o
bethel o 2018년 3월 29일
댓글: Thomas61197 2020년 3월 31일
I am trying to use matlab function fitrm. But the input 'WithinDesign' does not seem to make any sense to me. It seems as anything with the same length as the number of repeated measures is acceptable and the final output seem independent of the this WithinDesign. Take for instance:
load repeatedmeas
rm = fitrm(between,'y1-y8 ~ Group*Gender','WithinDesign',within)
ranova(rm)
and
load repeatedmeas
rm = fitrm(between,'y1-y8 ~ Group*Gender','WithinDesign',[1:8])
ranova(rm)
and
load repeatedmeas
rm = fitrm(between,'y1-y8 ~ Group*Gender','WithinDesign',zeros(8,1))
ranova(rm)
all produces the exact same output, as shown in the attached image.
Could someone please explain to me why they are all the same. Since its all the same what is the point of specifying it?. Also could some explain the design matrix 'within', What is it really telling the program to do, any reference to SPSS would be great.
Thanks.

채택된 답변

Jeff Miller
Jeff Miller 2018년 3월 29일
WithinDesign lets you store specific numeric values associated with the levels of the within-Ss factors in the RepeatedMeasuresModel object that fitlm produces as output. For example, these values might be the exact dosages of some drug if you were comparing 8 dosages. As you have noted, these don't affect the ANOVA output per se, but they can affect subsequent things you do with the output object.
For example, you get different plots with:
rm8 = fitrm(between,'y1-y8 ~ Group*Gender','WithinDesign',[1:8])
plot(rm8)
rm0 = fitrm(between,'y1-y8 ~ Group*Gender','WithinDesign',zeros(8,1))
plot(rm0)
The ANOVA model doesn't care what numerical values are associated with those 8 dosages, but it is still nice to show them in the plot. As another example, you would also need the dosage values if you wanted to compute a linear trend across the 8 dosages.
As far as I know, SPSS doesn't integrate the X values into its repeated measures ANOVAs in this way (but I don't know SPSS that well).
  댓글 수: 2
Adam Danz
Adam Danz 2019년 5월 22일
+1 good explanation
Thomas61197
Thomas61197 2020년 3월 31일
if y1-y8 are variables containing the response values to different dosages then 'y1-y8 ~ Group*Gender' means the response to the different dosages depends on the independent variables Group and Gender. If you would like to know what the effect is of the different dosages on the response, the model specification would look like this: 'response ~ dosage' where response is a dependent variable containing numerical values and where dosage is a independent catagorical variable containing the 8 dosages, y1-y8. Here 'between' would be a table with the amount of rows corrosponding to the number of obervations and containing the two variables response and dosage.
My question is: what do i put here?
rm = fitrm(between,'response ~ dosage','WithinDesign', here)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Ahmed Ramadan
Ahmed Ramadan 2018년 7월 26일
To correctly specify within design, you need to modify your ranova command as follows.
ranovatbl = ranova(rm,'WithinModel','w1+w2')
review the example on ranova help page
On that page, you'll see different p-values for the two cases:
  1. ranovatbl = ranova(rm)
  2. [ranovatbl,A,C,D] = ranova(rm,'WithinModel','w1+w2')
  댓글 수: 1
Adam Danz
Adam Danz 2019년 5월 22일
That only specifies the within-subject variable names. The question was regarding the within-subject model input to fitrm(). An example of that is here:

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Repeated Measures and MANOVA에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by