[R-sig-ME] Mixed linear model with nested and interaction term

Steve Denham @tevedrd @ending from y@hoo@com
Mon May 7 13:14:53 CEST 2018


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: 

 
> anova(model_MW)
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:


> anova(model_MW)
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:
> Hi all,
>
> I am analyzing my data with following model,
>
> model1 <- lmer(Yield~Treatment+(1|Location)+(1|Location:Treatment)+(1|Location:Block), data=A)
>
> in here, I want to set an random interaction term (Location*treatment) and an random nested term (block nested within location).
>
> But I couldn't get similar ANOVA results when I compare the output with SAS porc mixed output.
>
> So, I think i might make some mistake in the model in R...
>
> Can anyone give me some suggestion?
>
> Thanks in advance!
>
> Heng-An
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
  
	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list