Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Mixed Model (SAS to Stata)


From   "Raphael Fraser" <[email protected]>
To   [email protected]
Subject   Re: st: Mixed Model (SAS to Stata)
Date   Fri, 20 Apr 2007 13:01:59 -0500

Thanks Phil. It worked. I have three more model to imitate in Stata if
any one is able to:

1) I tried using -xtregar- but didn't work and it appear xtmixed does
not have the AR(1) option.
proc mixed data=cholst;
    class newid;
    model cholst = year / s;
    random intercept year / type=un subject=newid g;
    repeated / type=ar(1) subject=newid;
run;

2) don't understand the last line of code.
proc mixed data=cholst;
    class newid;
    model cholst = year / s;
    random intercept year / type=un subject=newid g;
    repeated / type=vc subject=newid;
    estimate "long-cross" year 1 age -1;
run;

3) again, don't understand last line.
proc mixed data=cholst;
    class newid;
    model cholst = sex age year sex*year age*year  / s;
    random intercept year / type=un subject=newid g;
    repeated / type=vc subject=newid;
    estimate "rate-diff" sex*year 1 age*year -10;
run;

Regards,
Raphael



On 4/19/07, Philip Ender <[email protected]> wrote:
Raphael Fraser wrote:

  Can anyone produce the equivalent code in Stata? A snippet of the data
  named "cholst" is given below.

  proc mixed data=cholst;
      class newid;
      model cholst = year / s;
      random intercept year / type=un subject=newid g;
      repeated / type=vc subject=newid;
  run;

I think the -xtmixed- code that comes closest to what you want would
be something like this:

xtmixed cholst year || newid: year, var cov(un)

By the way, I believe the "class newid;" statement in your SAS code is
unnecessary because newid is not a categorical variable in the model.
It doesn't hurt but it doesn't help either.

--
Phil Ender
Statistical Consulting Group
UCLA  Academic Technology Services
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index