Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: SAS vs Stata boxcox output [SEC: UNCLASSIFIED]


From   "Gosse, Michelle" <Michelle.Gosse@foodstandards.gov.au>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: SAS vs Stata boxcox output [SEC: UNCLASSIFIED]
Date   Wed, 7 Sep 2011 08:35:59 +1000

Greetings list,

I have been learning a lot about Stata, and have appreciated the support I have received from this list in the past.

I'm now at the point where I need to translate a proc transreg from SAS into Stata. The purpose is to identify the lamda value associated with the lowest log likelihood.

This is using a boxcox transformation, where the 9 independent variables are actually covariates. The independents are not being transformed by the procedure during the iterations. The SAS code limits the lambda to the range 0.05 to 1, using steps of 0.05. There is an output dataset from the SAS code so that each lambda value is a row, that also contains the respective RSquare, root mean square error, and log likelihood for that lambda value. A ci column shows the row that contains the log likelihood, but I can locate that using e(ll).

The SAS code is:
proc transreg data=data0; 
          where added_sugar >0;
          model BoxCox(added_sugar / lambda=0.05 to 1 by 0.05) = identity(age1 age2 age3 age4 age5 race1 race2 weekend replicate);
          run;

All the covariates are dummy variables, value of 0 or 1. Replicate indicates whether the observation is a repeated measure.

My attempted solution:
boxcox new_ADD_SUG agegrp4 agegrp5 agegrp6 agegrp7 agegrp8 race1 race3 weekend seq2, model(lambda) notrans(agegrp4 agegrp5 agegrp6 agegrp7 agegrp8 race1 race3 weekend seq2)

However, I get collinearity errors. What have I done wrong with my boxcox statement (the lhs option will perform a theta transformation, not lambda, so that is not an option)?

How can I identify the lambda associated with the minimum log likelihood - this does not appear to be saved in e()? I can get the log likelihood with display e(ll), but I cannot find how to get the lambda associated with it.

Cheers
Michelle


UNCLASSIFIED
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Scanned by Clearswift SECURE Email Gateway at Food Standards ANZ.

**********************************************************************

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index