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

# RE: st: Problem with variables in gllamm

 From "Alice Dalton (MED)" <[email protected]> To "[email protected]" <[email protected]> Subject RE: st: Problem with variables in gllamm Date Mon, 7 Oct 2013 13:20:21 +0000

```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

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: [email protected] [mailto:owner-
>[email protected]] On Behalf Of William Buchanan
>Sent: Monday, October 07, 2013 1:31 PM
>To: [email protected]
>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)" <[email protected]> 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
>>
>> 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/
```