The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
------------------------------
Message: 4
Date: Mon, 13 Feb 2012 16:43:51 +0000 (UTC)
From: Ben Bolker <bbolker at gmail.com>
To: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] Considerable discrepancies between fixed and
random effect estimates of lme4 (glmer) and glmmADMB
Message-ID: <loom.20120213T045329-772 at post.gmane.org>
Content-Type: text/plain; charset=utf-8
Adam Smith <raptorbio at ...> writes:
> I hope I'm not overlooking something elementary here, but estimated
> fixed and random effects are considerably different from the
> following Poisson model in lme4 and glmmADMB.? The fixed effects
> seem to differ most considerably...? Thanks for any thoughts...
> Adam Smith
> > sessionInfo()
> R version 2.14.1 (2011-12-22)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> (SNIP)
>
> other attached packages:
> [1] glmmADMB_0.7.2.5?? lme4_0.999375-42?? Matrix_1.0-3??????
bbmle_1.0.4.1????? numDeriv_2010.11-1
> [6] lattice_0.20-0???? R2admb_0.7.5?????? MASS_7.3-16??????
> > str(cons09) # The dataset
> 'data.frame':?? 394 obs. of? 15 variables:
> ?$ plot?????? : Factor w/ 16 levels "n_10","n_2","n_3",..:
> 2 2 2 2 2 2 2 2 2 2 ...
> ?$ plot_trt?? : Factor w/ 32 levels
> "cont_n_10","cont_n_2",..: 2 2 2 2 2 2 2 2 2 2 ...
> ?$ geog?????? : Factor w/ 2 levels "n","s": 1 1 1 1 1 1 1 1 1 1 ...
> ?$ trt??????? : Factor w/ 2 levels "cont","trt": 1 1 1 1 1 1 1 1 1 1 ...
> ?$ count????? : Factor w/ 14 levels "1","2","3","4",..:
> 1 2 3 4 5 6 7 8 9 10 ...
> ?$ total????? : int? 341 326 257 244 185 141 128 121 115 84 ...
> ?$ cons?????? : int? 12 52 8 57 36 8 0 1 20 27 ...
> ?$ dt???????? : int? 4 3 3 3 3 3 3 3 3 3 ...
> ?$ obs??????? : Factor w/ 394 levels "1","2","3","4",..:
> 1 2 3 4 5 6 7 8 9 10 ...
> ?$ logtotal?? : num? 5.83 5.79 5.55 5.5 5.22 ...
> ?$ logdt????? : num? 1.39 1.1 1.1 1.1 1.1 ...
> # The models
> > Poiss <- glmmadmb(cons ~ count + geog + trt + count:trt +
> count:geog + trt:geog + offset(logtotal) +
> ??? ??? offset(logdt) + (1|plot) + (1|plot_trt),
> zeroInflation=FALSE, family="poisson", data=cons09)
>
> > P_glmer <- glmer(cons ~ count + geog + trt +
> count:trt + count:geog + trt:geog + offset(log(total)) +
> ??? ? offset(log(dt)) + (1|plot) +
> (1|plot_trt), family="poisson", data=cons09)
By the way, you can specify these fixed effects
more compactly as (count+geog+trt)^2 ...
> > fixef(Poiss)
> 0.77333 0.58885 -0.21547 0.79101 0.24924 -0.02565 0.36004
> -0.94852 0.39442 0.29032 0.13658 -0.39564
> -1.37470 -0.88496 -0.53259 -0.25434
> -0.41033 1.18840 0.25678 0.69734
> 0.59823 1.11430 -0.17330 -0.15364
> 0.98442 0.51533 -0.99431 -1.63920 -0.40455 -1.55670 0.15891
> 0.35378 0.45748 0.92293 0.78373 1.05440
> 0.39598 0.32019 1.41600
> 0.86656 2.45790 1.07350 -0.31149
> # After detaching glmmADMB and lme4, then
> re-requiring lme4 to avoid masking of lme4's fixef function
> > fixef(P_glmer)
> -5.00326871 0.69554781 0.17105622 1.29467717
> 0.97268949 0.87707266 1.39399967 0.22923370
> 1.61829807 1.84546906 1.99506279 1.37859852
> 0.53987085 1.13282524 -0.12901214 0.07021103
> -0.52669841 0.87378323 0.05397134 0.46901053
> 0.39863837 0.94486828 -0.18146287 -0.20340655
> 0.77866847 0.49935778 -0.65101999 -1.05381279
> -0.05290984 -1.54103716 -0.03887633 0.04570463 0.02076874
> 0.47883964 0.23057821 0.49408747
> -0.15116087 -0.32683907 0.50098187 0.14670125
> 1.63961096 0.40944384 -0.22555478
>
> I juxtapose ranef() estimates here for comparison's sake...
>
[snip]
There's nothing obviously wrong here. It's not a full solution,
but I wonder how wide the confidence intervals are ... if they
are very wide, then the practical answer is that these are poorly
determined estimates. You're probably overfitting the model --
2 random effects plus 43 fixed-effect coefficients is
quite a lot for 394 observations (the general rule of thumb
is N/(# params)>10), especially if the Poisson data are sparse
(although they don't look that way from the first few
values listed in str() -- is there anyway you can allow
'count' to be continuous, or ordinal, rather than insisting
on it being categorical?) But it would be best to try to answer
more definitively ... can you send data?
Ben Bolker
------------------------------
Message: 5
Date: Mon, 13 Feb 2012 09:22:24 -0800
From: Tao Zhang <zt020200 at gmail.com>
To: r-sig-mixed-models at r-project.org
Subject: [R-sig-ME] Any package for best subset selection for random
effects model
Message-ID:
<CADMWRionUd97x-oUuUqj0nUStGiSZohudJLVh4kctEY0tC8=cw at mail.gmail.com>
Content-Type: text/plain
Hi Pros,
I know leaps() computes the best subset selection for linear model,
and
the bestglm() computes the best subset selection for generalized linear
model. Is there any package for best subset selection on random effects
model, or mixed effects model?
Thank you!
Tao
[[alternative HTML version deleted]]
------------------------------
Message: 6
Date: Mon, 13 Feb 2012 13:41:43 -0500
From: Gang Chen <gangchen6 at gmail.com>
To: r-sig-mixed-models <r-sig-mixed-models at r-project.org>
Subject: [R-sig-ME] Interpretation of nonlinear mixed-effects modeling
results
Message-ID:
<CAHmzXO6hydefDRtcZAgbuHBhiJXGfM6zDxDfPkP=k8LouY5suQ at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
I'm fitting a nonlinear mixed-effects model to some data with two
groups (controls and patients) with something like
fm <- nlme(response ~ myFunc(time, a, b), data=myData, fixed = a + b
~ group, start=...)
myFunc is a nonlinear function defined with two parameters a and b.
I'm very confused with the results between summary(fm) and anova(fm):
> summary(fm)
...
Fixed effects: a + b ~ group
Value Std.Error DF t-value p-value
a.(Intercept) 29.905889 10.532769 2196 2.839319 0.0046
a.groupPat 6.437218 16.045223 2196 0.401192 0.6883
b.(Intercept) 0.290943 0.072544 2196 4.010559 0.0001
b.groupPat -0.138361 0.077339 2196 -1.789010 0.0738
...
> anova(fm)
numDF denDF F-value p-value
a.(Intercept) 1 2196 497.8594 <.0001
a.group 1 2196 12.6109 0.0004
b.(Intercept) 1 2196 45.2787 <.0001
b.group 1 2196 3.2006 0.0738
If I understand it correctly, the last row in the fixed effects table
of summary(fm) is the difference in parameter b between the two
groups, and the t-statistic (and p-value) matches the F-statistic (and
p-value) from the last row of anova(fm): (-1.789010)^2 = 3.2006.
However, I'm totally at a loss for the other three rows in the two
tables? For example, I thought a.groupPat (2nd row) in the summary(fm)
table is the amount in parameter a in Patient group that is more than
parameter a in the Control group (1st row); but this interpretation is
not consistent with what is shown in the 2nd row of anova(fm) table.
What am I missing here?
Thanks,
Gang
------------------------------
Message: 7
Date: Mon, 13 Feb 2012 14:06:57 -0500
From: Adam Smith <raptorbio at hotmail.com>
To: <bbolker at gmail.com>, <r-sig-mixed-models at r-project.org>
Subject: Re: [R-sig-ME] Considerable discrepancies between fixed and
random effect estimates of lme4 (glmer) and glmmADMB
Message-ID: <BAY170-W29F87F0CC98BFF5E9B7F8EA17F0 at phx.gbl>
Content-Type: text/plain; charset="iso-8859-1"
> > I hope I'm not overlooking something elementary here, but estimated
> > fixed and random effects are considerably different from the
> > following Poisson model in lme4 and glmmADMB. The fixed effects
> > seem to differ most considerably... Thanks for any thoughts...
> > Adam Smith
>
> > > sessionInfo()
> > R version 2.14.1 (2011-12-22)
> > Platform: x86_64-pc-mingw32/x64 (64-bit)
> >
> > (SNIP)
> >
> > other attached packages:
> > [1] glmmADMB_0.7.2.5 lme4_0.999375-42 Matrix_1.0-3
> bbmle_1.0.4.1 numDeriv_2010.11-1
> > [6] lattice_0.20-0 R2admb_0.7.5 MASS_7.3-16
>
>
> > > str(cons09) # The dataset
> > 'data.frame': 394 obs. of 15 variables:
> > $ plot : Factor w/ 16 levels "n_10","n_2","n_3",..:
> > 2 2 2 2 2 2 2 2 2 2 ...
> > $ plot_trt : Factor w/ 32 levels
> > "cont_n_10","cont_n_2",..: 2 2 2 2 2 2 2 2 2 2 ...
> > $ geog : Factor w/ 2 levels "n","s": 1 1 1 1 1 1 1 1 1 1 ...
> > $ trt : Factor w/ 2 levels "cont","trt": 1 1 1 1 1 1 1 1 1 1 ...
> > $ count : Factor w/ 14 levels "1","2","3","4",..:
> > 1 2 3 4 5 6 7 8 9 10 ...
> > $ total : int 341 326 257 244 185 141 128 121 115 84 ...
> > $ cons : int 12 52 8 57 36 8 0 1 20 27 ...
> > $ dt : int 4 3 3 3 3 3 3 3 3 3 ...
> > $ obs : Factor w/ 394 levels "1","2","3","4",..:
> > 1 2 3 4 5 6 7 8 9 10 ...
> > $ logtotal : num 5.83 5.79 5.55 5.5 5.22 ...
> > $ logdt : num 1.39 1.1 1.1 1.1 1.1 ...
>
>
> > # The models
> > > Poiss <- glmmadmb(cons ~ count + geog + trt + count:trt +
> > count:geog + trt:geog + offset(logtotal) +
> > offset(logdt) + (1|plot) + (1|plot_trt),
> > zeroInflation=FALSE, family="poisson", data=cons09)
> >
> > > P_glmer <- glmer(cons ~ count + geog + trt +
> > count:trt + count:geog + trt:geog + offset(log(total)) +
> > offset(log(dt)) + (1|plot) +
> > (1|plot_trt), family="poisson", data=cons09)
>
> By the way, you can specify these fixed effects
> more compactly as (count+geog+trt)^2 ...
Indeed, I was being explicit for explicitness' sake...
>
> > > fixef(Poiss)
>
> > 0.77333 0.58885 -0.21547 0.79101 0.24924 -0.02565 0.36004
> > -0.94852 0.39442 0.29032 0.13658 -0.39564
> > -1.37470 -0.88496 -0.53259 -0.25434
> > -0.41033 1.18840 0.25678 0.69734
> > 0.59823 1.11430 -0.17330 -0.15364
> > 0.98442 0.51533 -0.99431 -1.63920 -0.40455 -1.55670 0.15891
> > 0.35378 0.45748 0.92293 0.78373 1.05440
> > 0.39598 0.32019 1.41600
> > 0.86656 2.45790 1.07350 -0.31149
>
> > # After detaching glmmADMB and lme4, then
> > re-requiring lme4 to avoid masking of lme4's fixef function
> > > fixef(P_glmer)
> > -5.00326871 0.69554781 0.17105622 1.29467717
> > 0.97268949 0.87707266 1.39399967 0.22923370
> > 1.61829807 1.84546906 1.99506279 1.37859852
> > 0.53987085 1.13282524 -0.12901214 0.07021103
> > -0.52669841 0.87378323 0.05397134 0.46901053
> > 0.39863837 0.94486828 -0.18146287 -0.20340655
> > 0.77866847 0.49935778 -0.65101999 -1.05381279
> > -0.05290984 -1.54103716 -0.03887633 0.04570463 0.02076874
> > 0.47883964 0.23057821 0.49408747
> > -0.15116087 -0.32683907 0.50098187 0.14670125
> > 1.63961096 0.40944384 -0.22555478
> >
> > I juxtapose ranef() estimates here for comparison's sake...
> >
> [snip]
>
> There's nothing obviously wrong here. It's not a full solution,
> but I wonder how wide the confidence intervals are ... if they
> are very wide, then the practical answer is that these are poorly
> determined estimates. You're probably overfitting the model --
> 2 random effects plus 43 fixed-effect coefficients is
> quite a lot for 394 observations (the general rule of thumb
> is N/(# params)>10), especially if the Poisson data are sparse
> (although they don't look that way from the first few
> values listed in str() -- is there anyway you can allow
> 'count' to be continuous, or ordinal, rather than insisting
> on it being categorical?) But it would be best to try to answer
> more definitively ... can you send data?
I started with a general specification of count expecting to model
it with an additive term when I start comparing fixed effects.? I
suppose I could model it as a lower order polynomial initially...
Doing so should drastically reduce the number of fixed effects in
the model.? I suppose I should center it before creating the
polynomial terms...
However, I'll still send the data off-list.?
Thanks for looking this over.
>
> Ben Bolker
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
------------------------------
_______________________________________________
R-sig-mixed-models mailing list
R-sig-mixed-models at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
End of R-sig-mixed-models Digest, Vol 62, Issue 29
**************************************************