Skip to content
Prev 16564 / 20628 Next

Mixed linear model with nested and interaction term

The point of the REML method is that there are no sums of squares for the covariance effects.? In fact, there are no sums of squares for any of the effects.? Type III calculates covariance parameters using method of moments, while REML uses restricted maximum likelihood.
Steve Denham Senior Director, Bioinformatics Sciences ?MPI Research, Inc.
On Monday, May 7, 2018, 3:41:37 PM EDT, Lin, Heng-An <henganl2 at illinois.edu> wrote:
Hi,?

When I using SAS with default REML, it won't display the sum of square.?
It only shows covariance parameter estimates for random effect,?for the fixed effect, it still using Type 3.?

I am trying using the code below in r to see the difference with smaller and balanced data set?anova(model_MW, ddf="Kenward-Roger")anova(model_MW, type=3)anova(model_MW, type=3, ddf="Kenward-Roger")

here is what I got in R?
and in SAS? (with type3 and KR method)? ? ? ? ? ? ? ? ?df? ? ?Sum Sq? ? ?F value? p-value?Treatment? ?4? ? ?78.9246? ? 0.81? ? ? 0.5801
They seems more similar for F and P value, but the Sum sq still different...not sure why?Sorry for sending repeating email.
Thanks for your time again.??: Steve Denham [stevedrd at yahoo.com]
????: 2018?5?7? ?? 06:14
?: Ben Bolker; Lin, Heng-An
??: r-sig-mixed-models at r-project.org
??: Re: [R-sig-ME] Mixed linear model with nested and interaction term

Hi Heng-An,
What do you get when you let SAS use the default REML method (i.e. remove the method=type3 statement)?? I suspect that it is much closer to the R results, and would be what most SAS modelers would consider more appropriate for this design.
Steve Denham Senior Director, Bioinformatics Sciences ?MPI Research, Inc.
On Friday, May 4, 2018, 4:16:04 PM EDT, Lin, Heng-An <henganl2 at illinois.edu> wrote:
**? Sorry I didn't notice that the format of the previous email was off, so I just send the same email again


Here is my SAS syntax and output : 

proc mixed data=A method=type3; class Location Block Treatment;
model Yield= Treatment/ddfm=kr;
random Location Location*Treatment Block(Location);
run;quit;

Source? ? ? ? ? ? ? ? ? ? ? Df? Sum_of_squares? F_value? 
Treatment? ? ? ? ? ? ? ? 4? ? 46.196951? ? ? ? ? 0.41
Location? ? ? ? ? ? ? ? ? ? 2? ? 4670.0979652? ? 44.74
Location*Treatment? 8? ? 224.44332? ? ? ? ? 1.66
Block (Location)? ? ? ? 9? ? 369.782487? ? ? ? 2.43
Residual? ? ? ? ? ? ? ? ? ? 34? ? 574.051330


And here is R output:
Analysis of Variance Table
? ? ? ? ? ? ? Df? Sum Sq? Mean Sq? F value
Treatment 4? 34.847? 8.7118? ? ? 0.5085


I am not sure why the sum of square, and the F- value are different.? 
Maybe is because I use type III in SAS and in lmer is using REML? 

I would also like to check the sum of square of other factors as SAS did, is there any way could do this in lmer?
I am really new to this, Thanks for your time! 

Heng-An 
________________________________________
?: R-sig-mixed-models [r-sig-mixed-models-bounces at r-project.org] ?? Lin, Heng-An [henganl2 at illinois.edu]
????: 2018?5?4? ?? 02:36
?: Ben Bolker
??: r-sig-mixed-models at r-project.org
??: Re: [R-sig-ME] Mixed linear model with nested and interaction term

Thanks!!


Here is my SAS syntax and output :

proc mixed data=A method=type3; class Location Block Treatment;
model Yield= Treatment/ddfm=kr;
random Location Location*Treatment Block(Location);
run;quit;

Source

DF

Sum of Squares

Mean Square

Error DF

F Value

Pr > F

Treatment

4

46.196951

11.549238

8.0509

0.41

0.7954

Location

2

4670.979652

2335.489826

9.2885

44.74

<.0001

Location*Treatment

8

224.443332

28.055417

34

1.66

0.1442

Block(Location)

9

369.782487

41.086943

34

2.43

0.0295

Residual

34

574.051330

16.883863

.

.

.













And here is R output:
Analysis of Variance Table
? ? ? ? ? ? ? Df? Sum Sq? Mean Sq? F value
Treatment 4? 34.847? 8.7118? ? ? 0.5085


I am not sure why the sum of square, and the F- value are different.
Maybe is because I use type III in SAS and in lmer is using REML?

I would also like to check the sum of square of other factors as SAS did, is there any way could do this in lmer?
[[elided Yahoo spam]]

Heng-An
________________________________________
?q: Ben Bolker [bbolker at gmail.com]
?H????: 2018?~5??4?? ?U?? 01:39
??: Lin, Heng-An
???: r-sig-mixed-models at r-project.org
?D??: Re: [R-sig-ME] Mixed linear model with nested and interaction term

This seems like a reasonable model specification. Can you show us
the results you're getting from R and SAS, and your SAS syntax (some
people here understand that language), so that we can see what looks
different? (It would help if you also wrote a few sentences about
what you see as the important differences between the results.)
On Fri, May 4, 2018 at 2:30 PM, Lin, Heng-An <henganl2 at illinois.edu> wrote:
? ? ? ? [[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models