Yes, the age still is discrepant but I mostly am noting the DDFs.  They
match entirely with the CS but not so with the UN.  I would love to get the
CS to match perfectly but this is what isn't working currently.

On Tue, Jan 24, 2012 at 8:48 PM, Thompson,Paul <
Paul.Thompson@sanfordhealth.org> wrote:

> In the CS model, the F values for Gender and Gender*age are really close,
> but age is quite discrepant. That seems problematic.
>
> -----Original Message-----
> From: r-sig-mixed-models-bounces@r-project.org [mailto:
> r-sig-mixed-models-bounces@r-project.org] On Behalf Of Charles Determan Jr
> Sent: Tuesday, January 24, 2012 8:32 PM
> To: r-sig-mixed-models@r-project.org
> Subject: [R-sig-ME] Trouble Replicating Unstructured Mixed Procedure in R
>
> Greetings,
>
> I have been working on R for some time now and I have begun the endeavor of
> trying to replicate some SAS code in R.  I have scoured the forums but
> haven't been able to find an answer.  I hope one of you could be so kind as
> to enlighten me.
>
> I am attempting to replicate a repeated measures experiment using some
> standard data.  I have posted the SAS code and output directly from a
> publication as well as my attempts in R to replicate it.  My main issue
> comes with the 'unstructured' component.
>
> The 'dental' dataset from 'mixedQF' package,
> equivalent to formixed data in SAS
>
>    distance age Subject    Sex
> 1       26.0   8     M01   Male
> 2       25.0  10     M01   Male
> 3       29.0  12     M01   Male
> 4       31.0  14     M01   Male
> 5       21.5   8     M02   Male
> 6       22.5  10     M02   Male
> 7       23.0  12     M02   Male
> 8       26.5  14     M02   Male
> 9       23.0   8     M03   Male
> 10      22.5  10     M03   Male
> 11      24.0  12     M03   Male
> 12      27.5  14     M03   Male
> 13      25.5   8     M04   Male
> 14      27.5  10     M04   Male
> 15      26.5  12     M04   Male
> 16      27.0  14     M04   Male
> 17      20.0   8     M05   Male
> 18      23.5  10     M05   Male
> 19      22.5  12     M05   Male
> 20      26.0  14     M05   Male
> 21      24.5   8     M06   Male
> 22      25.5  10     M06   Male
> 23      27.0  12     M06   Male
> 24      28.5  14     M06   Male
> 25      22.0   8     M07   Male
> 26      22.0  10     M07   Male
> 27      24.5  12     M07   Male
> 28      26.5  14     M07   Male
> 29      24.0   8     M08   Male
> 30      21.5  10     M08   Male
> 31      24.5  12     M08   Male
> 32      25.5  14     M08   Male
> 33      23.0   8     M09   Male
> 34      20.5  10     M09   Male
> 35      31.0  12     M09   Male
> 36      26.0  14     M09   Male
> 37      27.5   8     M10   Male
> 38      28.0  10     M10   Male
> 39      31.0  12     M10   Male
> 40      31.5  14     M10   Male
> 41      23.0   8     M11   Male
> 42      23.0  10     M11   Male
> 43      23.5  12     M11   Male
> 44      25.0  14     M11   Male
> 45      21.5   8     M12   Male
> 46      23.5  10     M12   Male
> 47      24.0  12     M12   Male
> 48      28.0  14     M12   Male
> 49      17.0   8     M13   Male
> 50      24.5  10     M13   Male
> 51      26.0  12     M13   Male
> 52      29.5  14     M13   Male
> 53      22.5   8     M14   Male
> 54      25.5  10     M14   Male
> 55      25.5  12     M14   Male
> 56      26.0  14     M14   Male
> 57      23.0   8     M15   Male
> 58      24.5  10     M15   Male
> 59      26.0  12     M15   Male
> 60      30.0  14     M15   Male
> 61      22.0   8     M16   Male
> 62      21.5  10     M16   Male
> 63      23.5  12     M16   Male
> 64      25.0  14     M16   Male
> 65      21.0   8     F01 Female
> 66      20.0  10     F01 Female
> 67      21.5  12     F01 Female
> 68      23.0  14     F01 Female
> 69      21.0   8     F02 Female
> 70      21.5  10     F02 Female
> 71      24.0  12     F02 Female
> 72      25.5  14     F02 Female
> 73      20.5   8     F03 Female
> 74      24.0  10     F03 Female
> 75      24.5  12     F03 Female
> 76      26.0  14     F03 Female
> 77      23.5   8     F04 Female
> 78      24.5  10     F04 Female
> 79      25.0  12     F04 Female
> 80      26.5  14     F04 Female
> 81      21.5   8     F05 Female
> 82      23.0  10     F05 Female
> 83      22.5  12     F05 Female
> 84      23.5  14     F05 Female
> 85      20.0   8     F06 Female
> 86      21.0  10     F06 Female
> 87      21.0  12     F06 Female
> 88      22.5  14     F06 Female
> 89      21.5   8     F07 Female
> 90      22.5  10     F07 Female
> 91      23.0  12     F07 Female
> 92      25.0  14     F07 Female
> 93      23.0   8     F08 Female
> 94      23.0  10     F08 Female
> 95      23.5  12     F08 Female
> 96      24.0  14     F08 Female
> 97      20.0   8     F09 Female
> 98      21.0  10     F09 Female
> 99      22.0  12     F09 Female
> 100     21.5  14     F09 Female
> 101     16.5   8     F10 Female
> 102     19.0  10     F10 Female
> 103     19.0  12     F10 Female
> 104     19.5  14     F10 Female
> 105     24.5   8     F11 Female
> 106     25.0  10     F11 Female
> 107     28.0  12     F11 Female
> 108     28.0  14     F11 Female
>
> *Mixed modeling and fixed effect test*
> SAS
> proc mixed data=formixed;
> class gender age person;
> model y = gender|age;
> repeated / type=cs sub=person;
> run;
>
> output of interest to me
>          Tests of Fixed Effects
> Source             NDF   DDF    Type III F    Pr > F
> GENDER           1        25        9.29        0.0054
> AGE                  3        75       35.35       0.0001
> GENDER*AGE   3        75        2.36        0.0781
>
> R (nlme package)
> y=lme(distance~Sex*age, random=(~1|Subject), data=dental)
> anova(y)
>
>            numDF denDF  F-value p-value
> (Intercept)     1    75 4123.156  <.0001
> Sex              1    25    9.292  0.0054
> age               3    75   40.032  <.0001
> Sex:age        3    75    2.362  0.0781
>
> Now this isn't exact but it is extremely close, however when I try to
> replicate the unstructured,
>
> SAS
> proc mixed data=formixed;
> class gender age person;
> model y = gender|age;
> repeated / type=un sub=person;
> run;
>
>             Tests of Fixed Effects
> Source          NDF DDF Type III F Pr > F
> GENDER         1    25     9.29    0.0054
> AGE                3    25    34.45   0.0001
> GENDER*AGE 3    25     2.93    0.0532
>
> R
> either
> y=lme(distance~Sex*age, random=(~1|Subject), corr=corSymm(,~1|Subject),
> data=dental)
> anova(y)
> or
> z=lme(distance~Sex*age, random=(~1|Subject), corr=corSymm(), data=dental)
> anova(z)
>
> gives the output
>
>            numDF denDF  F-value    p-value
> (Intercept)     1    75     4052.028  <.0001
> Sex              1    25       8.462      0.0075
> age               3    75      39.022    <.0001
> Sex:age        3    75       2.868      0.0421
>
> What am I doing wrong to replicate the unstructured linear mixed model from
> SAS?
>
> Regards,
>
> Charles
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
> -----------------------------------------------------------------------
> Confidentiality Notice: This e-mail message, including any attachments,
> is for the sole use of the intended recipient(s) and may contain
> privileged and confidential information.  Any unauthorized review, use,
> disclosure or distribution is prohibited.  If you are not the intended
> recipient, please contact the sender by reply e-mail and destroy
> all copies of the original message.
>
>

	[[alternative HTML version deleted]]


