Eiko--
At this point I hope one of the real experts can chime in to help you.

Tom

On Tue, Sep 3, 2013 at 7:26 AM, Torvon <torvon@gmail.com> wrote:

> Tom --
>
>    That you so much, that was extremely helpful. I had read up on LME4 for
> a few days now, including the longitudinal book chapter and some tutorials.
> I did not know about the FAQ before.  Please allow me 2 follow up
> questions.
>
>    I have 9 nominal symptoms (yes,no). I use the multivariate "trick"
> discussed now and then in stats mailing lists: I use data in a long long
> format (time * number of DVs), and then use a predictor that codes the DVs
> the same way time is used to code time. Specifically, I have 9 symptoms,
> and I predict the symptom severity (yes,no) using the variable "index"
> which contains information about which symptom each symptom is (1-9). I
> have 2 timepoints. My main research question is whether symptoms increase
> differentially over time.
>
>    To do so, would you agree that the following test would do the trick?
> > m.a1<-glmer(symptoms ~ index + time + (time|UserID), family = binomial,
> data = data)
> > m.a2<-glmer(symptoms ~ index * time  + (time|UserID), family = binomial,
> data = data)
>    I find that m2 fits significantly better (the plots show differential
> change, too).
>
>    Regarding the random effects, I find that
> > m.b1... (1|UserID)
> fits equally well as
> > m.b2 ... (1|UserID) + (1|time)
>  but that
> > m.b3 ... (time|UserID)
> drastically increases model fit. If I understand you and the FAQ
> correctly, the last model would be a "generalized linear mixed model with
> random intercept and random slope that allows the random effects to be
> correlated"?
>
>    My second question is the following: I want to test whether the 9
> symptoms at only one measurement point are equally severe
> (cross-sectional). Same "long long" data format. My idea was to compare a
> model which contains no information about symptom nature (and thus will
> constrain symptom severities to be equal) with a model containing this
> information:
> > m.c1<-glm(symptoms ~ 1, data=data2)
> > m.c2<-glm(symptoms ~ phq_index, data=data2)
>
>    Does that make sense? Since it is cross sectional, I thought about
> using GLM instead of GLMER.
>
> >             no AIC     logLik   LR.stat df  Pr(>Chisq)
> > m.c1      1 4473.9 -2236.0
> > m.c2      9 4187.3 -2084.7  302.62  8   < 2.2e-16 ***
>
> Thank you!
>    Eiko
>
>
>
>
>
>
>
>
> On 28 August 2013 19:26, Philippi, Tom <tom_philippi@nps.gov> wrote:
>
>> Torvon--
>> I'll reply, and save the experts for the harder questions.
>> 0) your syntax isn't quite right, but maybe its a typo.
>>      m1<-glmer(a ~ b *c  + (1|d), family = binomial, data = data)
>>                                          ^
>> 1)  See the FAQ http://glmm.wikidot.com/faq
>> You probably don't want to eliminate random effects just to simplify your
>> model.  Even if they are not interesting or large, they should represent
>> sources of variation in your experimental or sampling design, and thus you
>> _need_ them for the rest of your model to reflect and test your structure.
>>  [Others may disagree with that perspective, but it's mine and, more
>> importantly, an approximation of that of the developers of lme4.]  If you
>> have a valid reason for testing magnitudes of random effects, the FAQ also
>> covers some approaches.
>> In general, anova() on mer objects compares the fixed effects models, and
>> requires that the random effects be specified the same in both models.
>>
>> 2) (1|d) is an intercept (1) for each level of the random factor d.
>>     (1+Time|d) is a random slopes model: fitting an intercept plus slope
>> or coefficient for Time for each level of d, then estimating the variances
>> and covariance of those 2 distributions.  Any of several books on mixed
>> models in R give more detail than the FAQ and lme4 documentation.  Doug
>> Bates has a forthcoming book with draft chapters linked from the FAQ.
>>
>> 3) Any recommendation about comparing models, or about model structure,
>> depends on your experimental/sampling design, and on your questions.  I
>> have random plots nested within fixed zones, and remeasured over time.  I
>> am interested in trends over time, and whether those trends differ between
>> zones.  My response variable can be binomial (percent cover out of 100
>> points) or poisson (count of individuals).  My PlotID variable is unique
>> across zones, and my time is numeric.  Therefore, I use the following
>> nested models:
>>     library(lme4)
>>     library(pbkrtest) # for additional tests
>>     mod1 <- lmer(Count~Zone*Time +
>> (1+Time|PlotID),data=Lottia,family='poisson')
>>     mod2 <- lmer(Count~Zone + Time +
>> (1+Time|PlotID),data=Lottia,family='poisson')
>>     anova(mod1,mod2) # LR tests
>>     PBmodcomp(mod1,mod2,nsim=10000) # parametric bootstrap version of test
>>
>> Note that if I had family='gaussian', I would need to set REML=FALSE in
>> order to use likelihood ratio tests (RMEL is ignored in glmer).
>>
>> I hope that this helps more than just telling you to read the FAQ, but
>> you still need to read the FAQ.
>>
>> Tom
>>
>>
>> On Wed, Aug 28, 2013 at 9:14 AM, Torvon <torvon@gmail.com> wrote:
>>
>>>  Dear all ---
>>>    I have 2 few questions regarding the random effects of a glmer model I
>>> am running in lme4.
>>>
>>> (1)
>>> I would like to know whether I "need" a random effect in the model, so I
>>> want to compare a model with vs. a model without random effect.
>>> My final model is:
>>> > m1<-glmer(a ~ b *c (1|d), family = binomial, data = data)
>>> To what model do I compare this model? Is the following correct?
>>> > m0<-glm(a ~ b*c, family = binomial, data = data)
>>> > anova(m0,m1)
>>> does not give likelihood values or compare model fit as it usually does.
>>> What am I doing wrong?
>>>
>>> (2)
>>> I have not quite understood whether (1|d) is a random intercept, or a
>>> random slope, or a random intercept random slope model.
>>> Could you provide literature for lme4 that explains this?
>>> Would you recommend comparing a baseline model to a random intercept
>>> model
>>> to a random intercept random slope model to see what model is best to
>>> use?
>>>
>>> Thank you very much
>>>   Eiko
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-mixed-models@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>
>>
>>
>>
>> --
>> -------------------------------------------
>> Tom Philippi, Ph.D.
>> Quantitative Ecologist & Data Therapist
>> Inventory and Monitoring Program
>> National Park Service
>> Tom_Philippi@nps.gov
>> http://science.nature.nps.gov/im/monitor
>>
>
>


-- 
-------------------------------------------
Tom Philippi, Ph.D.
Quantitative Ecologist & Data Therapist
Inventory and Monitoring Program
National Park Service
Tom_Philippi@nps.gov
http://science.nature.nps.gov/im/monitor

	[[alternative HTML version deleted]]

