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]

From |
"Alice Dalton (MED)" <A.Dalton@uea.ac.uk> |

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

Subject |
RE: st: Problem with variables in gllamm |

Date |
Mon, 7 Oct 2013 15:59:52 +0000 |

Yes, the data are in long/stacked format... >-----Original Message----- >From: owner-statalist@hsphsun2.harvard.edu [mailto:owner- >statalist@hsphsun2.harvard.edu] On Behalf Of Nirup M Menon >Sent: Monday, October 07, 2013 4:19 PM >To: statalist@hsphsun2.harvard.edu >Subject: RE: st: Problem with variables in gllamm > >In case of repeated measures within an ID, I have had to generate an >additional ID for the repeating level ("route" in your case). Then I had to stack >the variables using the reshape command: > >gen routeID=_n >reshape long y, i(idno routeID) j(item) > >Did you do the above? ("j-item" is only needed if you have multiple variables, >but looks like you have one DV, and no IV/controls). > > > > >-----Original Message----- >From: owner-statalist@hsphsun2.harvard.edu [mailto:owner- >statalist@hsphsun2.harvard.edu] On Behalf Of Alice Dalton (MED) >Sent: Monday, October 07, 2013 10:27 AM >To: statalist@hsphsun2.harvard.edu >Subject: RE: st: Problem with variables in gllamm > >I have tested the dv by coding.0021 = 0 and all other non-missing values = 1 >and comparing this with the previous model .0021 = 0 and all other non- >missing values as the original proportions (thanks Richard). The model outputs, >however, are different. If the gllamm model is not running correctly, is there >another option which allows multilevel modelling where the dv is a proportion? >Thanks again, Alice > >.0021 = 0 and all other non-missing values = 1 > >. gllamm Overlap50BuffPropZeroOne, i(Id) family(binomial) link(logit) > >Iteration 0: log likelihood = -11.645217 (not concave) >Iteration 1: log likelihood = -11.184372 >Iteration 2: log likelihood = -10.546455 >Iteration 3: log likelihood = -10.367375 >Iteration 4: log likelihood = -10.249232 (not concave) >Iteration 5: log likelihood = -9.9592308 (not concave) >Iteration 6: log likelihood = -9.9586721 (not concave) >Iteration 7: log likelihood = -9.9586414 (not concave) >Iteration 8: log likelihood = -9.9586414 > >number of level 1 units = 276 >number of level 2 units = 51 > >Condition Number = 16383.537 > >gllamm model > >log likelihood = -9.9586414 > >------------------------------------------------------------------------------ >Overlap50B~e | Coef. Std. Err. z P>|z| [95% Conf. Interval] >-------------+---------------------------------------------------------- >-------------+------ > _cons | 792.8736 4252.152 0.19 0.852 -7541.192 9126.939 >------------------------------------------------------------------------------ > > >Variances and covariances of random effects >------------------------------------------------------------------------------ > > >***level 2 (Id) > > var(1): 79744.543 (856931) >------------------------------------------------------------------------------ > > >.0021 = 0 and all other non-missing values as original proportions > >. gllamm Overlap50BuffPropWithZeros, 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) >------------------------------------------------------------------------------ > > >>-----Original Message----- >>From: owner-statalist@hsphsun2.harvard.edu [mailto:owner- >>statalist@hsphsun2.harvard.edu] On Behalf Of Richard Williams >>Sent: Monday, October 07, 2013 3:33 PM >>To: statalist@hsphsun2.harvard.edu; statalist@hsphsun2.harvard.edu >>Subject: RE: st: Problem with variables in gllamm >> >>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/ > >* >* 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**:**RE: st: Problem with variables in gllamm***From:*"Alice Dalton (MED)" <A.Dalton@uea.ac.uk>

**RE: st: Problem with variables in gllamm***From:*Richard Williams <richardwilliams.ndu@gmail.com>

**RE: st: Problem with variables in gllamm***From:*"Alice Dalton (MED)" <A.Dalton@uea.ac.uk>

**RE: st: Problem with variables in gllamm***From:*Nirup M Menon <nmenon@gmu.edu>

- Prev by Date:
**Re: st: Filling mata results in a matrix** - Next by Date:
**RE: st: bootsrap random number use** - Previous by thread:
**RE: st: Problem with variables in gllamm** - Next by thread:
**RE: st: Problem with variables in gllamm** - Index(es):