[R] Nested mixed effectts question

Phillip Alday ph||||p@@|d@y @end|ng |rom mp|@n|
Fri Jan 18 12:33:51 CET 2019


(once again with the list)

Hi Caroline,

This question is probably better suited to r-sig-mixed-models
(https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models). Some things
are hard to tell without better understanding your design (I am not an
ecologist/relevant type of biologist), but I'll give it a go.

I suspect that your model is over-parameterized. It's very rare to see a
factor occur both as a fixed effect and as a grouping variable (the
stuff behind the | ) in the random effects.

If you don't care about particular sites but rather only the general
pattern across sites, then I would start with the model:

wrack.biomass ~ year  + (1 + year | site/trans)

This treats site as a known source of variance, but not one that you
care about estimating particular effects for. You can still extract
predictions for them, i.e. the BLUPs, via coef(wrackbio), but their
theoretical interpretation is a bit different than the other option below.

If you do care about particular sites, I would use the model

# if your transects are uniquely labeled across sites
wrack.biomass ~ year * site + (1 | trans)
# if the transect labels are only unique within sites
wrack.biomass ~ year * site + (1 | sites:trans)

This will give you fixed effects as in your model, but models the
transects as a source of repetition and hence variance due to that
grouping. The choice of exact specification depends on the labeling in
your dataset; the sites:trans just guarantees unique labelling. The
random effect in this case would estimate the average variance across
all sites due to transects.

Best,
Phillip




On 16/01/19 12:00, r-help-request using r-project.org wrote:
> Send R-help mailing list submissions to

> Today's Topics:
>
>    6. Nested mixed effectts question (Caroline)
> ----------------------------------------------------------------------
> Hi,
>
> I am helping a friend with an analysis for a study where she sampled
wrack biomass in 15 different sites across three years. At each site,
she sampled from three different transects. She is trying to estimate
the effect of year*site on biomass while accounting for the nested
nature (site/transcet) and repeated measure study design.
>
> wrack.biomass ~ year * site + (1 | site/trans)
>
> However she gets the following warning messages:
> Warning messages:
> 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
>   unable to evaluate scaled gradient
> 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
>    Hessian is numerically singular: parameters are not uniquely determined
>
> And her model output is:
>
>> summary(wrackbio)
> Linear mixed model fit by REML
> t-tests use  Satterthwaite approximations to degrees of freedom
['lmerMod']
> Formula: (actual.mean.biomass.m2.50.m.transect) ~ year * site + (1 |
site/trans)
>    Data: wrack_resp_allyrs_transname
>
> REML criterion at convergence: 691
>
> Scaled residuals:
>     Min      1Q  Median      3Q     Max
> -3.3292 -0.2624 -0.0270  0.1681  3.8024
>
> Random effects:
>  Groups     Name        Variance Std.Dev.
>  trans:site (Intercept)  0.0000  0.0000
>  site       (Intercept)  0.5531  0.7437
>  Residual               94.6453  9.7286
> Number of obs: 132, groups:  trans:site, 44; site, 15
>
> Fixed effects:
>                     Estimate Std. Error         df t value Pr(>|t|)
> (Intercept)        9.692e+00  5.666e+00  1.119e-04   1.711    0.999
> year2016           1.256e+01  7.943e+00  8.700e+01   1.582    0.117
> year2017           2.395e+00  7.943e+00  8.700e+01   0.302    0.764
> siteCL             5.672e+01  8.013e+00  1.119e-04   7.079    0.999
> siteDO            -4.315e+00  8.013e+00  1.119e-04  -0.539    0.999
> siteFL             7.872e+00  8.013e+00  1.119e-04   0.982    0.999
> siteFS            -7.619e+00  8.013e+00  1.119e-04  -0.951    0.999
> siteGH             4.369e+00  8.013e+00  1.119e-04   0.545    0.999
> siteLB            -3.747e+00  8.013e+00  1.119e-04  -0.468    0.999
> siteLBP           -5.298e+00  8.943e+00  1.736e-04  -0.592    0.999
> siteNB            -2.953e+00  8.013e+00  1.119e-04  -0.369    1.000
> siteNS             1.005e+00  8.013e+00  1.119e-04   0.125    1.000
> sitePC            -5.238e+00  8.013e+00  1.119e-04  -0.654    0.999
> siteSB            -7.649e+00  8.013e+00  1.119e-04  -0.955    0.999
> siteSILT          -4.734e+00  8.013e+00  1.119e-04  -0.591    0.999
> siteSL            -7.890e+00  8.013e+00  1.119e-04  -0.985    0.999
> siteUD            -8.230e+00  8.013e+00  1.119e-04  -1.027    0.999
> year2016:siteCL   -6.359e+01  1.123e+01  8.700e+01  -5.660 1.91e-07 ***
> year2017:siteCL   -5.210e+01  1.123e+01  8.700e+01  -4.638 1.23e-05 ***
> year2016:siteDO   -1.550e+01  1.123e+01  8.700e+01  -1.380    0.171
> year2017:siteDO   -3.022e+00  1.123e+01  8.700e+01  -0.269    0.789
> year2016:siteFL   -7.522e+00  1.123e+01  8.700e+01  -0.670    0.505
> year2017:siteFL   -1.167e+01  1.123e+01  8.700e+01  -1.039    0.302
> year2016:siteFS   -1.391e+01  1.123e+01  8.700e+01  -1.238    0.219
> year2017:siteFS   -2.170e+00  1.123e+01  8.700e+01  -0.193    0.847
> year2016:siteGH   -9.135e+00  1.123e+01  8.700e+01  -0.813    0.418
> year2017:siteGH   -4.031e+00  1.123e+01  8.700e+01  -0.359    0.721
> year2016:siteLB   -8.668e+00  1.123e+01  8.700e+01  -0.772    0.442
> year2017:siteLB   -1.530e+00  1.123e+01  8.700e+01  -0.136    0.892
> year2016:siteLBP  -5.336e+00  1.256e+01  8.700e+01  -0.425    0.672
> year2017:siteLBP  -1.826e+00  1.256e+01  8.700e+01  -0.145    0.885
> year2016:siteNB   -7.999e+00  1.123e+01  8.700e+01  -0.712    0.478
> year2017:siteNB   -5.645e+00  1.123e+01  8.700e+01  -0.502    0.617
> year2016:siteNS   -8.871e+00  1.123e+01  8.700e+01  -0.790    0.432
> year2017:siteNS   -3.443e+00  1.123e+01  8.700e+01  -0.306    0.760
> year2016:sitePC   -1.603e+01  1.123e+01  8.700e+01  -1.427    0.157
> year2017:sitePC   -2.955e+00  1.123e+01  8.700e+01  -0.263    0.793
> year2016:siteSB   -1.316e+01  1.123e+01  8.700e+01  -1.171    0.245
> year2017:siteSB   -3.220e+00  1.123e+01  8.700e+01  -0.287    0.775
> year2016:siteSILT -1.616e+01  1.123e+01  8.700e+01  -1.438    0.154
> year2017:siteSILT -2.497e-01  1.123e+01  8.700e+01  -0.022    0.982
> year2016:siteSL   -1.004e+01  1.123e+01  8.700e+01  -0.894    0.374
> year2017:siteSL    1.123e+00  1.123e+01  8.700e+01   0.100    0.921
> year2016:siteUD   -1.345e+01  1.123e+01  8.700e+01  -1.197    0.235
> year2017:siteUD    3.810e+00  1.123e+01  8.700e+01   0.339    0.735
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> Correlation matrix not shown by default, as p = 45 > 12.
> Use print(x, correlation=TRUE)  or
>     vcov(x)        if you need it
>
> convergence code: 0
> unable to evaluate scaled gradient
>  Hessian is numerically singular: parameters are not uniquely determined
>
> Is the model unable to converge because her dataset is too small to
include an interaction term or is stemming from issues of model structure?
>
> Thanks!
>
> Caroline
>



More information about the R-help mailing list