[R-sig-ME] lmer function in R for linear mixed models : syntax - check

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Tue Jul 2 15:03:53 CEST 2024



On 2024-07-01 10:59 a.m., Kim Pearce via R-sig-mixed-models wrote:
> Dear Dr Bolker,
> 
> Many thanks for verifying last week that my syntax below was appropriate when we are considering a hypothetical situation where time (level 1) is nested within patient (level 2) and our hypothetical linear mixed model included random intercepts, fixed and random slopes for one continuous predictor (time), fixed and random slopes for another continuous predictor (dose) and  q-1 fixed slopes for the q category baseline severity group:
> 
> Modely <- lmer(Y ~ time + meddose + basesevgroupf + (time + meddose | subject), data=datafile)
> 
> Or equivalently:
> 
> Modely <- lmer(Y ~ time + meddose + basesevgroupf + (1+ time + meddose | subject), data=datafile)
> 
> You mentioned, "You would end up with a 3x3 covariance matrix (variation in intercept, slope with respect to time, and effect of dose across subjects, and 3 covariances)".
> 
> Am I correct in thinking that you mean that the syntax would allow us to look at :
> 
> 1. the estimate of the variance of the random intercepts (at position 1,1 in the covariance matrix),
> 
> 2. the estimate of the variance of the random slopes for time (at position 2,2 in the covariance matrix),
> 
> 3. the estimate of the variance of the random slopes for dose (at position 3,3 in the covariance matrix),
> 
> 4. the estimate of the covariance (correlation) between the random intercepts and random slopes for time (at position 2,1 [and 1,2 due to symmetry] in the covariance matrix),
> 
> 5. the estimate of the covariance (correlation) between the random intercepts and random slopes for dose (at position 3,1 [and 1,3 due to symmetry] in the covariance matrix), and
> 
> 6. the estimate of the covariance (correlation) between the random slopes for time and random slopes for dose (at position 3,2 [and 2,3 due to symmetry] in the covariance matrix).

   Yes, that's right.
> 
> Many thanks again, in advance, for verifying that my thoughts are correct.
> Best wishes,
> Kim
> 
> Dr Kim Pearce PhD, CStat, Fellow HEA
> Newcastle University
> 
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

-- 
Dr. Benjamin Bolker
Professor, Mathematics & Statistics and Biology, McMaster University
Director, School of Computational Science and Engineering
(Acting) Graduate chair, Mathematics & Statistics
 > E-mail is sent at my convenience; I don't expect replies outside of 
working hours.



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