Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

RE: st: Problem with variables in gllamm


From   Richard Williams <richardwilliams.ndu@gmail.com>
To   statalist@hsphsun2.harvard.edu, "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Problem with variables in gllamm
Date   Mon, 07 Oct 2013 09:33:08 -0500

At 08:20 AM 10/7/2013, Alice Dalton (MED) wrote:
Dear Statalist,

Apologies for omitting information/Stata output from my previous post (I'm new to Statalist and fairly new to Stata). I provide this below. Thanks in advance for your help, Alice

- The dependent variable is continuous (a proportion of range 0.0021 to 0.9976) (it measures proportion of overlap between actual and predicted commute routes). - I have 51 participants, each with between 1 and 10 observations (routes) (n=276 in total).
- I would like to run a fractional logit model (as I'm using proportions).
- I ran this as a gml command initially (glm Overlap50BuffProp Age Health_binaryReversed DistGIS PoI Bike Bus CarBike CarWalk Walk, family(binomial) link(logit) robust) - I'd like to run this in gllamm (so I can model for observations within participants). - I will have just a few predictors (indicated with the glm model as age, health, predicted route distance, points of interest en route, travel mode) - In the Problem 2 example I gave, I replaced the two lowest values with zero then the model worked

It may have ran, but I am not convinced it ran correctly. Based on your error message I am betting gllamm treated all the non-zero cases as equal to 1, the same as logit does. To test that idea, recode your dv so .0021 = 0 and all other non-missing values = 1. See if you get the same results using that as your dv. If so gllamm is not doing what you want, i.e. it is acting more like logit than it is like glm.


PROBLEM 1. Dependent variable will only work if the variable contains a zero:
a) Where smallest value = 0.0021, model fails

. gllamm   Overlap50BuffProp, i(Id) family(binomial) link(logit)
r(2000);

b) Where smallest value = 0 , model works (two values of 0.0021 changed to 0)

. gllamm    Overlap50BuffPropNoZeros, i(Id) family(binomial) link(logit)

Iteration 0:   log likelihood = -735.21677  (not concave)
Iteration 1:   log likelihood = -262.89672  (not concave)
Iteration 2:   log likelihood =  -214.7793  (not concave)
Iteration 3:   log likelihood = -189.90975
Iteration 4:   log likelihood = -181.77366
Iteration 5:   log likelihood = -180.63042
Iteration 6:   log likelihood = -180.59617
Iteration 7:   log likelihood = -180.59616

number of level 1 units = 276
number of level 2 units = 51

Condition Number = 1.2108434

gllamm model

log likelihood = -180.59616

------------------------------------------------------------------------------
Overlap50~os |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_cons | -.48261 .1711324 -2.82 0.005 -.8180232 -.1471967
------------------------------------------------------------------------------

Variances and covariances of random effects
------------------------------------------------------------------------------

***level 2 (Id)

    var(1): .52773855 (.29437029)
------------------------------------------------------------------------------
.

PROBLEM 2
Adding binary explanatory variables (0/ 1) into the working model (with zero in dependant variable)

. gllamm Overlap50BuffPropNoZeros Health_binaryReversed, i(Id) family(binomial) link(logit)
variables have been dropped, can't continue
r(198);



>-----Original Message-----
>From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
>statalist@hsphsun2.harvard.edu] On Behalf Of William Buchanan
>Sent: Monday, October 07, 2013 1:31 PM
>To: statalist@hsphsun2.harvard.edu
>Subject: Re: st: Problem with variables in glamm
>
>If your dependent variable is binary (like it is implied by the info you provide), >then the only values it should take are 0 & 1. Beyond that it isn't exactly clear >what your specific problem is. You should also include the _exact_ syntax you
>enter and the exact message/output provided by Stata.
>
>Sent from my iPhone
>
>> On Oct 7, 2013, at 6:53, "Alice Dalton (MED)" <A.Dalton@uea.ac.uk> wrote:
>>
>> Dear Statlist,
>>
>> I'm having a problem with the gllamm program (family(binomial) link(logit)).
>>
>> 1. My dependant variable (a proportion) will only work if the variable
>contains a zero, otherwise I get an r(2000) (no observations) error
>>
>> 2. Adding binary explanatory variables (eg a health variable where 1
>excellent, 0 not excellent) results in the message 'variables have been
>dropped, can't continue' and an r(198) error. The null model works; the null
>model works with continuous variables added in; the null model plus one or
>more binary variables fails.
>>
>> The command I am using is     gllamm  [depvar] [varlist], i(ParticipantId)
>family(binomial) link(logit). I have 276 cases and 129 variables (not all of which
>are added to the model).
>>
>> If anyone with experience of gllamm has an idea of what is happening here,
>I would be most grateful to hear it.
>>
>> Thank you!
>>
>> Alice Dalton
>>
>> *
>> *   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/

-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
WWW:    http://www.nd.edu/~rwilliam

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index