Solved – Mixed models (lme4) + lsmeans to estimate trend in population means

I aim to estimate one populations mean blood pressure during different years. Here is the setting:
(1) 7400 onservations; repeated measurements. Unbalanced.
(2) measurements are undertaken anually from 2001 to 2012. Eachindividual maybe measured several times.
(3) one can expect a time-bias, i.e as time progress, there will be made advances in therapy, which will lead to more efficient blood pressure lowering. These factors will not be taken into account. Deliberately.

Aim: estimate population mean blood pressure each year. Including confidence interval.

Methods: use lme4 package (linear outcome, blood pressure) to account for repeated measurements and lsmeans package to estimate the population mean each year.


fit <- lmer(bloodpressure ~ year + age + sex + (1 | patient_id), data=data)  'year' is the factor variable for which I'd like to obtsin the means.  lsmeans(fit, ~ year) # not tried 

– is this method OK?
– will the covariance be respected by using lsmeans, or should I use lmerTest package which has a built in function for estimating lsmeans?
– each individual has a random slope in the call above, should I adjust it to include random effects for year also?

Thanks for any advice on this

The lsmeans package does produce the correct results with model objects from a number of packages, including lme4. If you have a fairly recent update of lsmeans installed, you can do ? models and see information on what model objects are supported, and details of any special provisions.

Similar Posts:

Rate this post

Leave a Comment