I would like to know if there is a way I can run a SAS code (below) in JMP. Or how I can emulate the SAS code below in JMP.
proc mixed Class year week treatment rep; model stdmisummax=year|week|treatment/ddfm=kr residual; random rep(year) treatment*rep(year); repeated week/type=ar(1) subject=treatment*rep(year); run;
My factors are: Treatment, week (repeated measure), year, rep (replicate).
Thank you in advance.
PS: I've tried to run something similar in JMP using the repeated measures add in, but it won't work out, because I can't cross three factors to make the subject id.
I think my JMP version is not pro or it is some sort of pro version for the university.
I do not have SAS software.
Isadora,
I talked with Adam Morris about your question. Independently, I came up with the same results as him, even though I set the model up in a slightly different fashion. I liked his set up a bit better, so I'd use that one. Please let me know if you have additonal questions.
Don
@DonMcCormack Thank you very much for your response.
Would you mind sharing your solution as well? I'd like to compare them, because I'm interested in learning more about coding in JMP and other approaches for my data.
Thank you!
Isadora
My solution is below:
Fit Model(
Y( :Response ),
Effects(
:Treatment,
:Week,
:Treatment * :Week,
:Year,
:Treatment * :Year,
:Week * :Year,
:Treatment * :Week * :Year
),
Random Effects( :Rep[:Treatment, :Year] ),
NoBounds( 1 ),
Personality( "Mixed Model" ),
Subject( :Treatment, :Year, :Rep ),
Repeated Effects( :Week2 ),
Repeated Structure( "AR(1)" ),
Run( Variogram( AR1( 1 ) ) )
);
There are only two differences. For the additional random effect, I nested Rep in Year. I used Treatment, Year, and Rep to implicitly define Subject. I find Adam's approach of explicitly defining Subject more intuitively appealing, though.
@DonMcCormack That is very helpful!
Thanks for sharing it with me, and for giving me your opinion on which solution is the best approach. I really appreciate that.
Isadora
Hi Isadora,
To share with others reading this thread, the proposed solution (from JMP Technical Support) is to create a new Subject column that is the concatenation of the 3 variables identifying the subjects (Treatment, Year, and Rep).
It is also necessary to create a continuous copy of the Week column for use as the Repeated variable.
JMP Pro cannot fit the exact same model as specified by the SAS Code (For AR(1) models, JMP nests the random effects in the subject variable). However, JMP can fit the model omitting the Rep(Year) term. The script below shows how one might set this up.
Thanks,
Adam
New Column("Subject", Character, Formula( :Treatment || ", " || Char( :Year ) || ", " || Char( :Rep ) ));
New Column("Week2", numeric, continuous, formula(:Week));
Fit Model(
Y( :response ),
Effects(
:Treatment,
:Week,
:Year,
:Treatment * :Week,
:Treatment * :Year,
:Week * :Year,
:Treatment * :Week * :Year
),
Random Effects( :Treatment*:Year*:Rep ),
Subject(:Subject),
Repeated Effects( :Week2 ),
Repeated Structure( "AR(1)" ),
Personality( "Mixed Model" )
);
@AdamMorris , you have been so helpful!
Thank you so much for sharing your knowledge and all this good information! I appreciate that.
Hi @AdamMorris and @DonMcCormack
You can add more than one random effect in the analysis of repeated measures. However you will get a note saying “The repeated subject column has been nested in all random effects.” See the screenshot below. I think that is why Adam suggested dropping Rep(Year) because it will nest in Treatment.
Have you tried including two random effects? What have you seen?
@jiancao Thank you for your explanation.
Every time I include more than one random effects, I get "0" for Estimate, Std Error (see scren shot) for one of the random effects. Why would that be? Is it because of the nesting?
Thank you for your help,
Isadora
Yes, the random effect, Year(Subject), or whatever the first one, is the estimated between subject variation.