[ADMB Users] Nested random effects syntax in glmmADMB 0.6.2 alpha
Ben Bolker
bbolker at gmail.com
Thu Aug 4 20:57:56 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 11-08-05 12:52 AM, Shawn McCracken wrote:
> Today I managed to get the alpha version of glmmADMB 0.6.2 loaded and
> running. I am running negative binomial model with nested random effects.
>
> I decided to start with a reduced model of my data, so I began with the
> following syntax and R would just hang and I get the pinwheel of death
> (Mac OS 10.6.8):
>
>> m1=glmmadmb(Y~X+(1|A/B),data=ecpad5,family="nbinom")
>
> I can't find the exact mailing list message, but somewhere I believe I
> read that +(1|A)+(1|B) is the same as the above syntax in lme4 as long
> as factor B is coded with unique individual labels.
Yes, but at the moment they're not *quite* identical in glmmADMB. The
difference is that, if B is *implicitly* nested in A (i.e., the levels
are coded with unique individual labels as you have them above), the
interaction of A:B as naively constructed includes a lot of empty levels
(i.e. if we have A={I,II,III} and B={I.i,I.ii,II.i,II.ii,III.i,II.ii},
then A:B will contain levels that have no elements like I.II.i and so
forth). lme4 is smart and drops these levels; glmmADMB is not. I'm not
sure what the best approach is: I'm leaning toward *not* magically
simplifying as lme4 does, but rather giving a warning/error in the case
where there are lots of empty levels (it is of course possible that in a
slightly unbalanced design one would get a situation where there were a
*few* empty levels ...) The problem with making it only a warning and
not an error is that as in your case it might take an awfully long time
to get through the calculation to the point where the warning could be
provided.
For the time being, the bottom line is that if your data are
implicitly nested you should use the (1|A)+(1|B) and not the (1|A/B)
syntax (as you found out) -- reserve A/B for the case where explicit
nesting is necessary ...
>
> I then tried the following model syntax and it worked just fine:
>
>> m2=glmmadmb(Y~X+(1|A)+(1|B),data=ecpad,family="nbinom")
>> summary(m2)
>
> Coefficients:
> Estimate Std. Error z value Pr(>|z|)
> (Intercept) -0.841 0.234 -3.59 0.00034 ***
> treaty -0.702 0.311 -2.26 0.02413 *
> ---
> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> Number of observations: total=160, =32, =160
Hmm, this list of numbers of observations at each levels looks a little
bit funny (but not necessarily dangerous).
> Random effect variance(s):
> $tree
> (Intercept)
> (Intercept) 2.9858e-09
This is essentially zero (again, not necessarily a problem -- probably
just means you don't have enough data to detect a non-zero variance at
this level)
>
> $trbr
> (Intercept)
> (Intercept) 1.2847
>
> Negative binomial dispersion parameter: 403.43 (std. err.: 2.1584)
Hmmm. Provided it's being reported correctly, this is a very large
number -- it means your data are essentially Poisson once the random
effects are accounted for (unless your mean counts are very large --
which they're not).
However: it looks from the data below as though you don't have
repeated measurements per subplot. Since that's the case, you really
don't need two levels of hierarchy (and it explains why your data look
Poisson -- you're accounting for overdispersion in two different ways,
one by using the negative binomial and the other by using a subplot
(individual)- level random effect).
I would suggest modeling this as
m2=glmmadmb(Y~X+(1|A),data=ecpad,family="nbinom")
but I suspect you will still find that there is no detectable effect
of 'tree' (A) and that hence your fit will be essentially the same as if
you had done
glm.nb(Y~X,data=ecpad)
...
>
> Log-likelihood: -162.773
>
>
> My data structure:
>
> A =(randomly selected plot) B =(randomly selected sub-plot within A)
> X =(disturbed=Y or N) Y =(total count of individuals present)
>
> T01 B001
> N 2
> T01 B002
> N 0
> T01 B003
> N 0
> T01 B004
> N 1
> T01 B005
> N 0
> T02 B006
> N 0
> T02 B007
> N 4
> T02 B008
> N 1
> T02 B009
> N 0
> T02 B010
> N 0
> . .
> .
> .
> . .
> .
> .
> . .
> .
> .
> T32 B156
> Y 3
> T32 B157
> Y 0
> T32 B158
> Y 0
> T32 B159
> Y 1
> T32 B160
> Y 0
>
> Is glmmADMB treating B as being nested in A like it does in lme4? To the
> best of your knowledge do the results look like they should?
>
> I'll have more questions later but gotta get this sorted first.
>
> Thanks for the help,
>
> Shawn
>
>
>
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk47akQACgkQc5UpGjwzenMtqwCfQcuYhXoY6GeS99qjc943yfyT
sysAoIeSN0FFWXZUwT8mlDdE2mZ2518z
=X+UY
-----END PGP SIGNATURE-----
More information about the Users
mailing list