[R-sig-ME] glmer syntax for model with "common" random effects
Martin Stjernman
martin.stjernman at biol.lu.se
Fri May 16 11:22:46 CEST 2014
Hi all,
Am I completely off track claiming that (Norm_Combined|Pat_ID/Proc_ID) is equivalent to (Norm_XY :Norm_21|Pat_ID/Proc_ID) rather than to (Norm_XY * Norm_21|Pat_ID/Proc_ID) in the post by Thierry?
Norm_XY*Norm_21 would expand to Norm_XY + Norm_21 + Norm_XY:Norm_21 wouldn't it?
(Just to understand the formula specifications in R)
Sincerely
Martin
__________________________________________________________________________________
Martin Stjernman
Department of Biology
Lund University
Ecology building
S-223 62 Lund
Sweden
phone: +46 (0)46-222 38 20
mobile: +46 (0)708-810 887
fax: +46 (0)46-222 47 16
e-mail: martin.stjernman at biol.lu.se
__________________________________________________________________________________
-----Original Message-----
From: r-sig-mixed-models-bounces at r-project.org [mailto:r-sig-mixed-models-bounces at r-project.org] On Behalf Of ONKELINX, Thierry
Sent: den 16 maj 2014 10:24
To: orzack
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] glmer syntax for model with "common" random effects
Dear Steven,
Please keep the mailing list in cc. Others might chime in and you might get a faster reply.
You need to create a variable the combines both norms. That is what Norm_Combined <- interaction(Norm_XY, Norm_21) does. Then you could do glmer(Sex ~ 1 + Norm_XY + Norm_21 + (Norm_Combined|Pat_ID/Proc_ID), data = PGD_21.df,family = binomial). Note that this would be equivalent to glmer(Sex ~ 1 + Norm_XY + Norm_21 + (Norm_XY * Norm_21|Pat_ID/Proc_ID), data = PGD_21.df,family = binomial). So even more complex than your original model.
Note that (1|A/B) is equivalent to (1|A + 1|A:B) Therefor my suggestion to use (1|Pat_ID) + (1|PatID:Proc_ID) + (1|Pat_ID:Norm_Combined) + (1|PatID: Proc_ID:Norm_Combined) which is the verbatim of (1|PatID/Proc_ID/Norm_Combined) + (1|PatID/ /Norm_Combined). This model allows the same fit as (Norm_Combined|Pat_ID/Proc_ID) but assumes that all levels of Norm_Combined come from a univariate iid normal distribution (same variance and uncorrelated). (Norm_Combined|Pat_ID/Proc_ID) assumes that the levels of Norm_Combined come from a multivariate normal distribution. And hence requires a lot more parameters.
If this is not what you want, then give us the mathematical equation of the model that you need.
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
Thierry.Onkelinx at inbo.be
www.inbo.be
To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
-----Oorspronkelijk bericht-----
Van: orzack [mailto:orzack at freshpond.org]
Verzonden: woensdag 14 mei 2014 15:20
Aan: ONKELINX, Thierry
Onderwerp: RE: [R-sig-ME] glmer syntax for model with "common" random effects
Dear Thierry,
many thanks for your suggestion. I think we are talking past each other, which is likely mostly due to my not being clear and/or my not understanding your suggestion. Perhaps this would help clarify:
in my first email, I presented this model
>model <- glmer(Sex ~ 1 + Norm_XY + Norm_21 + ((Norm_XY +
>Norm_21)|Pat_ID/Proc_ID), data = PGD_21.df,family = binomial))
this generates a "common" or "overall" estimate of the intercept, i.e., one that estimates the random effects for both predictors combined. What I would like is a model that provides a similar "combined" estimate for the slope. it would be something like
>model <- glmer(Sex ~ 1 + Norm_XY + Norm_21 +
>((COMBINEDNORM)|Pat_ID/Proc_ID), data = PGD_21.df,family =
>binomial))
so that the fixed effects are calculated separately but norm-specific estimates of the random effects for the slope were not provided.
When I use the interaction approach you mention, glmer returns estimates for each combination of the levels
>
>I think you want something like this (if I understand you question correctly).
>
>PGD_21.df$Norm_Inter <- interaction(PGD_21.df$NormXY,
>PGD_21.df$Norm_21) model <- glmer(Sex ~ 1 + Norm_XY + Norm_21 + (1|Pat_ID) + (1|PatID:
>Proc_ID) + (1|Pat_ID:Norm_Inter) + (1|PatID: Proc_ID:Norm_Inter), data
>= PGD_21.df,family = binomial)
>
I want to reduce the AIC penalty. This increases it unless I misunderstand your syntax. Speaking of which, what does this syntax mean
1|PatID: Proc_ID:Norm_Inter?
In my problem, only PatID and Proc_ID provide estimates of random effects.
I look forward to hearing from you.
S.
--
Steven Orzack
The Fresh Pond Research Institute
173 Harvey Street
Cambridge, MA. 02140
617 864-4307
www.freshpond.org
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * * Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.
_______________________________________________
R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
More information about the R-sig-mixed-models
mailing list