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

li li hannah.hlx at gmail.com
Wed Jun 10 18:40:16 CEST 2015


Thanks all for the reply,

I think what Bert specified is what I wanted. Thanks very much.
So this model allows different random intercept term but the same
random slope term for the three methods.

I have an additional question. I would like to require differnt
residual variance also for the three groups. Is that possible?

Thanks!!

2015-06-09 17:25 GMT-04:00, Bert Gunter <bgunter.4567 at gmail.com>:
> Thierry:
>
> I don't think so. It looks to me like her syntax/understanding is confused.
> I think the call should be:
>
> mod2 <- lmer(result  ~ group*time+(group + time|lot), na.action=na.omit,
> data=alldata)
>
> Her request for "the same random slope for each group" -- I assume it's for
> time -- means to me that the time slope will vary "randomly" by lot only,
> the slope would be the same for all groups within the lot.
>
> Of course, I may be wrong also. If so, I suggest that she follow the
> posting guide and post at least head(alldata) using dput() to enable folks
> to understand the structure of her data. And only on r-sig-mixed-models --
> crossposting is frowned upon here and the mixed models list is the best bet
> for this sort of question anyway.
>
> As always, corrections and criticism welcome.
>
> Cheers,
> Bert
>
> Bert Gunter
>
> "Data is not information. Information is not knowledge. And knowledge is
> certainly not wisdom."
>    -- Clifford Stoll
>
> On Tue, Jun 9, 2015 at 1:49 PM, Thierry Onkelinx <thierry.onkelinx at inbo.be>
> 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-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.
>>
>



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