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 at the end of May, and its replacement, statalist.org is already up and running.


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

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


From   "Sun, Wensheng" <wsun@bcm.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: xtmixed with log-transfered dependent variable: back to non-log on margins and marginsplot
Date   Mon, 15 Apr 2013 10:26:32 -0500

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/


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