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 |
Michael Mitchell <Michael.Norman.Mitchell@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Omnibus effects following xtmelogit with margins |

Date |
Fri, 24 Sep 2010 12:45:26 -0700 |

Dear Rob Likewise, thank you for patiently hanging with me to explain this. I now see exactly what you are doing, and this now makes perfect sense with respect to how you are formulating the model as a three level model. I think that Phil Ender's suggestion about how to formulate "what is being predicted" combined with how to properly express the main effect are completely spot on and I bet that his suggestions will solve your original problem. My apologies for barking up the wrong tree, but I hope it was useful for you (or readers) to see the process. Best regards, Michael On Fri, Sep 24, 2010 at 12:21 PM, Ploutz-Snyder, Robert (JSC-SK)[USRA] <robert.ploutz-snyder-1@nasa.gov> wrote: > Michael, > My continued gratitude for hanging with me this long. > > If I understand your response correctly, once again I want to try describe my design to make certain that I have done a reasonable job at explaining myself. In hindsight as I explain this to you, my var names make it unnecessarily difficult to understand due to conventions of English (not stats). > > Subjects are measured "Pre" intervention... then several months later at the "Mid" point of the intervention... then one last time at the "End" of intervention. I have coded this variable as "time" with three levels. This is not to be confused with time as one reads on a clock--it is NOT the time of day. When I say "time" in this model, my meaning has to do with how long subjects were in the intervention, which in this experiment is measured in months. > > At each of these three points in the trial, we gather data. But because our data are difficult to measure (low sensitivity plus high daily day-to-day variability in expression), we takes 10 measurements spanning across 10 consecutive days (i.e. one per day), that together represents a cluster of measurement within each time period (pre, mid, end). Our data are dichotomous yes/no, with lots and lots of zeros, but any "hit" within the 10 consecutive periods is considered informative. We could simply collapse across the 10days into a single "yes-we had at least one hit" variable, but thought better to model the full 10days of data with an HLM-like model. > > So subjects are measured 10 days within each of three levels of time (pre, mid, post). We don't care to compare variability among the 10 measurements taken within "time" (pre, mid, post) so much, but we want to incorporate the nesting & variability in our model as we assess changes over the course of the trial (pre, mid, post) by group. One additional but minor point--we have two groups (not three). > > > Thus I view the 10 repeated observations as nested within "time" because "time" is the wider construct, with three levels of time pre, mid and post separated by several weeks to months. But the 10 consecutive daily samples are collected *within* each level of "time." > > > So Subject would be the lowest level. Within subject we have three levels of time (pre, mid, post). And with each time we have 10 repeated observations. > > Does that not make this a 3-level model?? Or... is the r.notation as you have offered apply here? > > > > > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Michael N. Mitchell > Sent: Friday, September 24, 2010 12:54 PM > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: Omnibus effects following xtmelogit with margins > > Dear Rob > > Thanks for that additional information... so, there are really two different variables > that represent a form of "time"... one being *day* (of which there are 10 levels), and one > being *time* of day (of which there are 3 levels). If I have this right, then it seems to > me that *time* is crossed with *day* (because every level of *time* appears with every > level of *day*). So, the way that I am thinking about this as an HLM style model, I would > write this as.... > > Level 1: Observations within subject > Y = B0 + B1*Time1 + B2*Time2 + B3*Day + B4*cov1 + B5*cov2 + e > > Level 2: Subject > B0 = G00 + G01*group + u0 > B1 = G10 + G11*group + u1 > B2 = G20 + G21*group + u2 > > Then combining this into a composite model (for estimating in Stata), I would get.... > > Y = G00 + G01*group + > G10*Time1 + G11*Time1*group + > G20*Time2 + G21*Time2*group + > B3*Day + B4*cov1 + B5*cov2 + e + u0 + u1 + u2 > > Then, in this fashion the model becomes... > > . xtmelogit y i.group i.time#i.group i.day cov1 cov2 >0 ||subj: R.time, nolog > > Note how I am formulating this as a two level model, with observations nested within > subject, and that -time- and -day- are both at the same level, at level 1. They way that > your model is formulated, it looks more to me like it is a three level model, with -time- > and -day- each forming their own level. If this was something like time nested within > students, and students nested within schools, I would think of this as a 3 level model, > but I cannot (myself) help but think of your model as a 2 level model (which might be the > lenses I am viewing this through). Maybe others have better lenses to share thoughts? > > Best regards, > > Michael N. Mitchell > Data Management Using Stata - http://www.stata.com/bookstore/dmus.html > A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html > Stata tidbit of the week - http://www.MichaelNormanMitchell.com > > > > On 2010-09-24 10.19 AM, Ploutz-Snyder, Robert (JSC-SK)[USRA] wrote: >> Thanks Michael, >> >> First... there was a glitch in my code-- the ">0 "was not supposed to be in the code (leftover from prev command that I stripped out). >> >> The true command is: >> >> xtmelogit y i.time##i.group cov1 cov2 ||subj: ||time:, nolog >> >> Here is why... This is data from a completely nested experimental design, where y is measured 10 consecutive days at each of three times. The 10 replications are conducted because the thing we are measuring (viral load in a very small quantity sample) is very difficult to obtain, thus the 10 repetitions. So we don't expect nor care to look for changes among the 10 consecutive measurements, but we do need to incorporate the cluster. >> >> >> So per subject, y is obtained 10x per time, thus time is nested within subject. I am not trying to model a random slope for time, but rather incorporate the double-nesting in my data. >> >> Does that make more sense? >> >> >> >> >> >> >> -----Original Message----- >> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Michael N. Mitchell >> Sent: Friday, September 24, 2010 12:05 PM >> To: statalist@hsphsun2.harvard.edu >> Subject: Re: st: Omnibus effects following xtmelogit with margins >> >> Dear Rob >> >> I wonder if you really want to specify the -xtmelogit- command as you have. I am >> wondering if you really wanted to do what you showed (repeated below)... >> >> . xtmelogit y i.time##i.group cov1 cov2>0 ||subj: ||time:, nolog >> >> or whether you want to do this... >> >> . xtmelogit y i.time##i.group cov1 cov2>0 ||subj: time, nolog >> >> I am thinking you might have intended the latter because that specifies a random >> intercept, as well as a random coefficient for the effect of time (at the subject level). >> The question that remains for me is whether you need to do something special because >> -time- is a factor variable, perhaps it is -||subj: R.time-, but I am not sure since I >> have never done this and see very little documentation on this. >> >> If this is the way you want to specify your model, then I think it might solve your >> -margins- problem. >> >> I hope this helps, >> >> Michael N. Mitchell >> Data Management Using Stata - http://www.stata.com/bookstore/dmus.html >> A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html >> Stata tidbit of the week - http://www.MichaelNormanMitchell.com >> >> >> >> On 2010-09-24 8.26 AM, Ploutz-Snyder, Robert (JSC-SK)[USRA] wrote: >>> Happy Friday Statalisters. >>> >>> I'm hoping someone can verify that -testparm- works appropriately to test the highest-order ominibus interaction effects following -xtmelogit- (as it works with xtmixed, for example). I also ran into a snag using -margins- as I usually do after an -xtmixed- model to obtain omnibus main effects for an ordinal factor variable. >>> >>> My model includes an indicator for time (three times) and an indicator for group (two groups) plus two continuous covariates. >>> >>> xtmelogit y i.time##i.group cov1 cov2>0 ||subj: ||time:, nolog >>> >>> ...output omitted... >>> >>> >>> My test of the omnibus interaction effect (as I would run following xtmixed) revealed: >>> >>> . testparm time#group2 >>> >>> ( 1) [eq1]2.time#10000.group2 = 0 >>> ( 2) [eq1]3.time#10000.group2 = 0 >>> >>> chi2( 2) = 6.46 >>> Prob> chi2 = 0.0396 >>> >>> But my use of -margins- to get the omnibus main effect for time (as I would with xtmixed) failed: >>> >>> . margins time, asbalanced atmeans >>> default prediction is a function of possibly stochastic quantities other than e(b) >>> r(498); >>> >>> >>> Any assistance on this error? Rob >>> >>> * >>> * For searches and help try: >>> * http://www.stata.com/help.cgi?search >>> * http://www.stata.com/support/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/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/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/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/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/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**RE: st: Omnibus effects following xtmelogit with margins***From:*"Ploutz-Snyder, Robert (JSC-SK)[USRA]" <robert.ploutz-snyder-1@nasa.gov>

**References**:**st: Omnibus effects following xtmelogit with margins***From:*"Ploutz-Snyder, Robert (JSC-SK)[USRA]" <robert.ploutz-snyder-1@nasa.gov>

**Re: st: Omnibus effects following xtmelogit with margins***From:*"Michael N. Mitchell" <Michael.Norman.Mitchell@gmail.com>

**RE: st: Omnibus effects following xtmelogit with margins***From:*"Ploutz-Snyder, Robert (JSC-SK)[USRA]" <robert.ploutz-snyder-1@nasa.gov>

**Re: st: Omnibus effects following xtmelogit with margins***From:*"Michael N. Mitchell" <Michael.Norman.Mitchell@gmail.com>

**RE: st: Omnibus effects following xtmelogit with margins***From:*"Ploutz-Snyder, Robert (JSC-SK)[USRA]" <robert.ploutz-snyder-1@nasa.gov>

- Prev by Date:
**RE: st: Omnibus effects following xtmelogit with margins** - Next by Date:
**RE: st: Omnibus effects following xtmelogit with margins** - Previous by thread:
**RE: st: Omnibus effects following xtmelogit with margins** - Next by thread:
**RE: st: Omnibus effects following xtmelogit with margins** - Index(es):