[R-sig-ME] [R] Different random intercepts but same random slope for groups

Ken Beath ken.beath at mq.edu.au
Wed Jun 10 01:10:56 CEST 2015


Why not

mod2 <- lmer(result  ~ group*time+(1+time|lot), na.action=na.omit,
data=alldata)

This gives different slopes by group but same random effect variance for
all lots, which I think is what you actually want. A random intercept must
always be included with a random slope (there are probably exceptions but I
can't think of any).

On 10 June 2015 at 08:08, Ben Bolker <bbolker at gmail.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>   I don't understand your model specification.  What do you mean,
> precisely, by "a different random intercept for each group but the
> same random slope effect for all three groups"?  That sounds a lot
> like a random intercept model? Do you mean that you want to specify a
> single random-effects *variance* among slopes for all lots (regardless
> of group) but different among-lot intercept variances for each group?
>
>   If group1, group2, group3 are numeric dummy variables, then
>
> lmer(result  ~ group*time+(0+time|lot) + (group1|lot) + (group2|lot) +
> (group3|lot), data=alldata)
>
> might work.
>
>   That said, Thierry may still be right.  You have 15 groups and are
> trying to fit 3 separate intercept-variance parameters ...
>
>
> On 15-06-09 04:49 PM, Thierry Onkelinx wrote:
> > Your model is too complex for the data. This gives you two options:
> > a) simplify the model and b) get more data.
> >
> > 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
> >
> > 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
> >
> > 2015-06-09 21:57 GMT+02:00 li li <hannah.hlx at gmail.com>:
> >
> >> Hi all, I'd like to fit a random intercept and random slope
> >> model. In my data, there are three groups. I want to have
> >> different random intercept for each group but the same random
> >> slope effect for all three groups. I used the following R
> >> command. However, there seems to be some problem. Any
> >> suggestions?
> >>
> >>
> >>
> >> mod2 <- lmer(result  ~ group*time+(0+group1+ group2 +
> >> group3+time|lot), na.action=na.omit, data=alldata)
> >>
> >>> summary(mod2)
> >> Model is not identifiable... summary from lme4 is returned some
> >> computational error has occurred in lmerTest Linear mixed model
> >> fit by REML ['merModLmerTest'] Formula: result ~ group * time +
> >> (0 + group1 + group2 + group3 + time | lot) Data: alldata
> >>
> >> REML criterion at convergence: 807.9
> >>
> >> Scaled residuals: Min      1Q  Median      3Q     Max -3.0112
> >> -0.3364  0.0425  0.2903  3.2017
> >>
> >> Random effects: Groups   Name     Variance Std.Dev. Corr lot
> >> group1   0.00000 0.000 group2   86.20156 9.284      NaN group3
> >> 55.91479 7.478      NaN  0.06 time      0.02855 0.169      NaN
> >> -0.99  0.10 Residual          39.91968 6.318 Number of obs: 119,
> >> groups:  lot, 15
> >>
> >> Fixed effects: Estimate Std. Error t value (Intercept)
> >> 100.1566     2.5108   39.89 group  group2        -2.9707
> >> 3.7490   -0.79 group  group3           -0.0717     2.8144
> >> -0.03 time                         -0.1346     0.1780   -0.76
> >> group  group2 :time   0.1450     0.2939    0.49 group
> >> group3:time        0.1663     0.2152    0.77
> >>
> >> Warning messages: 1: In checkConv(attr(opt, "derivs"), opt$par,
> >> ctrl = control$checkConv,  : Model failed to converge with
> >> max|grad| = 0.147314 (tol = 0.002, component 2) 2: In
> >> checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,
> >> : Model failed to converge: degenerate  Hessian with 2 negative
> >> eigenvalues
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more,
> >> see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read
> >> the posting guide http://www.R-project.org/posting-guide.html and
> >> provide commented, minimal, self-contained, reproducible code.
> >>
> >
> > [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-mixed-models at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> >
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
>
> iQEcBAEBAgAGBQJVd2PnAAoJEOCV5YRblxUHmRoH/22AjJ5RyFl3YEOeJ4/YerMf
> byc8etuVyjX/QpB5VG5XidwdaLCb9tf98SttwR9iWKeYUB6sm+UEtPhzmhNuQVSS
> O1aL8XgiTuoK0kNy1W8h7ZJovbaTeEl1FLy2sQ3ma5sRMvxfG30FZXI99NgvdLZf
> qhClz3egICgwa7sz4DiT/UwPjvbgY993ZEKhjiWpzu2Zgy6HPVo1GrT/OKEqJwdD
> 4gczHoAOMkGdc38c+br1AmgPK1Me+Gc/OoZ2gQwniSTpTN0lrluvs3l6Y20/zVjD
> 0CmvQ+hSKkpPLWRENWGMwBlNpzINXMc+OXcE+LIqaxTuCWFOu9uh78ZjyD8EaHA=
> =9aTo
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>



-- 

*Ken Beath*
Lecturer
Statistics Department
MACQUARIE UNIVERSITY NSW 2109, Australia

Phone: +61 (0)2 9850 8516

Building E4A, room 526
http://stat.mq.edu.au/our_staff/staff_-_alphabetical/staff/beath,_ken/

CRICOS Provider No 00002J
This message is intended for the addressee named and may...{{dropped:9}}



More information about the R-sig-mixed-models mailing list