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]

From |
Nick Cox <njcoxstata@gmail.com> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
Fwd: st: RE: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot |

Date |
Tue, 16 Apr 2013 00:38:30 +0100 |

Should be "corresponding changes in -gllamm-". Nick njcoxstata@gmail.com ---------- Forwarded message ---------- From: Nick Cox <njcoxstata@gmail.com> Date: 16 April 2013 00:37 Subject: Re: st: RE: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot To: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> I have never used -gllamm- (SSC) for real, but two broad comments may help clarify your situation. First, -gllamm- is a large and formidable command. People who have become competent in its use seem to report uniformly that you have to put in a lot of effort to understand it. So, it can be very difficult to advise other people what the right code is for their situation. Second, -gllamm- is being maintained through small fixes but I think it's fair comment that the author is not trying to match major innovations in Stata by corresponding changes in Stata. So, it doesn't work with factor variables and it doesn't work with -margins-. That may be most of the bad news already. As William said, you really have to work with the manual and what it documents. Nick njcoxstata@gmail.com On 15 April 2013 21:46, Sun, Wensheng <wsun@bcm.edu> wrote: > Hi, Please help. How to do post multilevel regression estimation after gllamm? I tried "margins" command, it seems not work. Please fix it for me. Thanks. > > Wensheng > > clear > set more off > set linesize 80 > webuse childweight > xi i.girl*age > g byte k =1 > eq cons: k > eq age: age > gllamm weight age _Igirl_1 _IgirXage_1, i(id) nrf(2) eqs(cons age) family(gaussian) link(log) adapt nolog > and the output was: > number of level 1 units = 198 > number of level 2 units = 68 > Condition Number = 9.3286293 > gllamm model > log likelihood = -369.79782 > ------------------------------------------------------------------------------ > weight | Coef. Std. Err. z P>|z| [95% Conf. Interval] > -------------+---------------------------------------------------------------- > age | .3312893 .0187497 17.67 0.000 .2945405 .368038 > _Igirl_1 | -.087405 .0484338 -1.80 0.071 -.1823335 .0075235 > _IgirXage_1 | .0047005 .0276294 0.17 0.865 -.0494522 .0588531 > _cons | 1.82589 .0329648 55.39 0.000 1.76128 1.8905 > ------------------------------------------------------------------------------ > Variance at level 1 > ----------------------------------------------------------------------------- > 2.0966599 (.24691662) > Variances and covariances of random effects > ----------------------------------------------------------------------------- > ***level 2 (id) > var(1): .00263901 (.00311924) > cov(1,2): .00065959 (.00057154) cor(1,2): 1 > var(2): .00016486 (.00043059) > ----------------------------------------------------------------------------- > > . margins girl, at(age=(0 (0.5)2.5)) > Warning: cannot perform check for estimable functions. > 'girl' not found in list of covariates > r(322); > . margins _Igirl_1, at(age=(0 (0.5)2.5)) > Warning: cannot perform check for estimable functions. > '_Igirl_1' not found in list of covariates > r(322); > . margins i.girl, at(age=(0 (0.5)2.5)) > Warning: cannot perform check for estimable functions. > 'girl' not found in list of covariates > r(322); > > > ________________________________________ > From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Sun, Wensheng [wsun@bcm.edu] > Sent: Monday, April 15, 2013 3:19 PM > To: statalist@hsphsun2.harvard.edu > Subject: RE: st: RE: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot > > Hi, Joseph and William, > > I just re-installed gllamm on my Stata 12. The codes work now. Thank you for your help. > > Wensheng > > ________________________________________ > From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Sun, Wensheng [wsun@bcm.edu] > Sent: Monday, April 15, 2013 3:07 PM > To: statalist@hsphsun2.harvard.edu > Subject: RE: st: RE: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot > > I used Stata 11 from my other computer to run the same code. I got the same results as you had listed below. But if I use Stata 12, I always got the same error message "1m2 invalid name". Is the code specifically not work in Stata 12, or just my copy of Stata 12 has some problem? Thanks. > > Wensheng > > ________________________________________ > From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of William Buchanan [william@williambuchanan.net] > Sent: Monday, April 15, 2013 10:46 AM > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: RE: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot > > Hi Wensheng, > > I'm not sure how you were able to generate that specific error message with those commands. I just ran: > > clear > set more off > set linesize 80 > webuse childweight > xi i.girl*age > g byte k =1 > eq cons: k > eq age: age > gllamm weight age _Igirl_1 _IgirXage_1, i(id) nrf(2) eqs(cons age) family(gaussian) link(log) adapt nolog > > and the output was: > > number of level 1 units = 198 > number of level 2 units = 68 > > Condition Number = 9.3286293 > > gllamm model > > log likelihood = -369.79782 > > ------------------------------------------------------------------------------ > weight | Coef. Std. Err. z P>|z| [95% Conf. Interval] > -------------+---------------------------------------------------------------- > age | .3312893 .0187497 17.67 0.000 .2945405 .368038 > _Igirl_1 | -.087405 .0484338 -1.80 0.071 -.1823335 .0075235 > _IgirXage_1 | .0047005 .0276294 0.17 0.865 -.0494522 .0588531 > _cons | 1.82589 .0329648 55.39 0.000 1.76128 1.8905 > ------------------------------------------------------------------------------ > > Variance at level 1 > ----------------------------------------------------------------------------- > 2.0966599 (.24691662) > > Variances and covariances of random effects > ----------------------------------------------------------------------------- > > ***level 2 (id) > > var(1): .00263901 (.00311924) > cov(1,2): .00065959 (.00057154) cor(1,2): 1 > > var(2): .00016486 (.00043059) > ----------------------------------------------------------------------------- > > > That being said, several list members have already suggested going through the GLLAMM manual in greater depth and detail to understand how to specify the model(s) that you are interested in. It isn't clear that you've followed the advice that others have already provided to you. Additionally, "Stata" provided you with an error message, not "STATA." > > HTH, > Billy > > > On Apr 15, 2013, at 8:26 AM, "Sun, Wensheng" <wsun@bcm.edu> wrote: > >> Thank you Joseph for the detailed codes. I tried, but STATA gives me the error message 1m2 invalid name. >> >> . clear >> . set more off >> . set linesize 80 >> . webuse childweight >> (Weight data on Asian children) >> . xi i.girl*age >> i.girl _Igirl_0-1 (naturally coded; _Igirl_0 omitted) >> i.girl*age _IgirXage_# (coded as above) >> . generate byte k = 1 >> . eq cons: k >> . eq age: age >> . gllamm weight age _Igirl_1 _IgirXage_1, i(id) nrf(2) eqs(cons age) family(gaus >>> sian) link(log) adapt nolog >> 1m2 invalid name >> >> Please let me know if I have miss something. Thank you very much! >> >> Wensheng >> >> ________________________________________ >> From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Joseph Coveney [stajc2@gmail.com] >> Sent: Sunday, April 14, 2013 10:11 PM >> To: statalist@hsphsun2.harvard.edu >> Subject: st: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot >> >> Wensheng Sun wrote: >> >> Thank you for the suggetion of log link and gllamm. I am new to gllamm. The >> following is the error message when I was trying gllamm. Please let me know how >> should I fix that. Thank you very much! >> >> [snip] >> >> -------------------------------------------------------------------------------- >> >> The user-written command -gllamm- pre-dates the introduction of factor variables >> in Stata, and so it doesn't recognize the factor-variable syntax that you typed. >> Prior to factor variables, Stata used the command -xi- to manually create >> regression terms for categorical variables and their interactions. The command >> -xi- is still around for use with those commands that do not allow >> factor-variable notation. I show its use with -gllamm- below for the model that >> you tried to fit. >> >> Your syntax for -gllamm- seems to be some kind of hodgepodge of that for >> -xtmixed- and -gllamm-. As others have mentioned, you're probably better off >> referring to the user's manual for -gllamm-, which can be downloaded from the >> website shown in the command's help file. >> >> Joseph Coveney >> >> >> . clear * >> >> . set more off >> >> . set linesize 80 >> >> . webuse childweight >> (Weight data on Asian children) >> >> . xi i.girl*age >> i.girl _Igirl_0-1 (naturally coded; _Igirl_0 omitted) >> i.girl*age _IgirXage_# (coded as above) >> >> . generate byte k = 1 >> >> . eq cons: k >> >> . eq age: age >> >> . gllamm weight age _Igirl_1 _IgirXage_1, i(id) nrf(2) eqs(cons age) family(gaus >>> sian) link(log) adapt nolog >> >> number of level 1 units = 198 >> number of level 2 units = 68 >> >> Condition Number = 9.3286288 >> >> gllamm model >> >> log likelihood = -369.79782 >> >> ------------------------------------------------------------------------------ >> weight | Coef. Std. Err. z P>|z| [95% Conf. Interval] >> -------------+---------------------------------------------------------------- >> age | .3312893 .0187497 17.67 0.000 .2945405 .368038 >> _Igirl_1 | -.0874049 .0484338 -1.80 0.071 -.1823335 .0075236 >> _IgirXage_1 | .0047005 .0276294 0.17 0.865 -.0494521 .0588531 >> _cons | 1.82589 .0329648 55.39 0.000 1.76128 1.8905 >> ------------------------------------------------------------------------------ >> >> Variance at level 1 >> ------------------------------------------------------------------------------ >> >> 2.0966596 (.2469165) >> >> Variances and covariances of random effects >> ------------------------------------------------------------------------------ >> >> >> ***level 2 (id) >> >> var(1): .00263901 (.00311924) >> cov(2,1): .00065959 (.00057154) cor(2,1): 1 >> >> var(2): .00016486 (.00043059) >> ------------------------------------------------------------------------------ >> >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/faqs/resources/statalist-faq/ >> * http://www.ats.ucla.edu/stat/stata/ >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/faqs/resources/statalist-faq/ >> * http://www.ats.ucla.edu/stat/stata/ > > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**References**:**st: RE: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot***From:*"Sun, Wensheng" <wsun@bcm.edu>

**st: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot***From:*"Joseph Coveney" <stajc2@gmail.com>

**st: RE: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot***From:*"Sun, Wensheng" <wsun@bcm.edu>

**Re: st: RE: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot***From:*William Buchanan <william@williambuchanan.net>

**RE: st: RE: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot***From:*"Sun, Wensheng" <wsun@bcm.edu>

**RE: st: RE: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot***From:*"Sun, Wensheng" <wsun@bcm.edu>

**RE: st: RE: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot***From:*"Sun, Wensheng" <wsun@bcm.edu>

**Re: st: RE: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**Re: st: RE: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot** - Next by Date:
**Re: st: quantile-quantile plots** - Previous by thread:
- Next by thread:
- Index(es):