Hi, I'm trying to convert the following SAS code in R to get the same result 
that I get from SAS. Here is the SAS code:
    DATA plants; 
    INPUT  sample $  treatmt $ y ; 
    cards; 

    1   trt1    6.426264755 
    1   trt1    6.95419631 
    1   trt1    6.64385619 
    1   trt2    7.348728154 
    1   trt2    6.247927513 
    1   trt2    6.491853096 
    2   trt1    2.807354922 
    2   trt1    2.584962501 
    2   trt1    3.584962501 
    2   trt2    3.906890596 
    2   trt2    3 
    2   trt2    3.459431619 
    3   trt1    2 
    3   trt1    4.321928095 
    3   trt1    3.459431619 
    3   trt2    3.807354922 
    3   trt2    3 
    3   trt2    2.807354922 
    4   trt1    0 
    4   trt1    0 
    4   trt1    0 
    4   trt2    0 
    4   trt2    0 
    4   trt2    0 
    ; 
    RUN; 

    PROC MIXED ASYCOV NOBOUND  DATA=plants ALPHA=0.05 method=ML; 
    CLASS sample treatmt; 
    MODEL  y = treatmt ; 
    RANDOM int treatmt/ subject=sample ; 
    RUN; I get the following covariance estimates from SAS:Intercept sample ==> 
5.5795treatmt sample ==> -0.08455Residual ==> 0.3181I tried the following in R, 
but I get different results.   options(contrasts = c(factor = "contr.SAS", 
ordered = "contr.poly"))
    df$sample=as.factor(df$sample) 
    lmer(y~ 1+treatmt+(1+treatmt|sample),REML=FALSE, data = df) Since the 
results from R are standard deviations, I have to square all results to get the 
variances.    sample==> 2.357412^2 = 5.557391
    sample*treatmt==>0.004977^2 = 2.477053e-05
    residual==>0.517094^2 = 0.2673862As shown above, the results from SAS and R 
are different. Do you know how to get the exact values in R?I appreciate any 
help.Thanks,Gram

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to