# Solved – Linear mixed effects model with time series

I have been reading through the different posts here on linear mixed effects models, but am still very unsure whether I have understood the task correctly, therefor I am reaching out for help by the community, any point in the right direction will be greatly appreciated!

The task I was given is described as follows:

The mean difference between treatment and placebo in terms of symptoms core values at Day1, Day2, Day3, Day4 will be estimated with a repeated linear mixed
effect model (LMM) with an unstructured covariance matrix. Treatment and time will be used as fixed effects, and baseline symptoms severity as a covariate.

• Dependent variable: Severity at given time
• Fixed effect: Treatment + Timepoint
• Covariate: Baseline measure

Example data:

``mydata <- data.frame(   Subject  = c(rep(c("F1", "F2", "F3", "F4"), each=4)),    Timepoint = c(rep(c("1", "2", "3", "4"), each=4)),    Treatment = c(rep(c("B", "A", "C", "B"), each = 4)),    Severity_at_given_time = c(6.472687, 7.017110, 6.200715, 6.613928,6.829968, 7.387583, 7.367293, 8.018853, 7.527408, 6.746739, 7.296910, 6.983360, 6.816621, 6.571689, 5.911261, 6.954988)) ``

And then fitting the model as follows:

``severity.model = lmer(Severity_at_given_time ~ Treatment + Timepoint + (1|Baseline_measure), data=my.data) summary(severity.model) ``

(In my full data that gives an R2 of 0.02)

Now I have to say I dont understand the part about "repeated LMM", why is that? From talking to the experimentalists they want to know whether there is a significant difference between treatment and placebo over time, which should already be captured by a single LMM?

Many thanks for feedback!

Contents

If understand correctly, you want to fit a multivariate regression model (aka marginal model) with an unstructured covariance matrix. This can be done, for example, using function `gls()` from package nlme. In your case, you could use something like:
``fm <- gls(Severity ~ Timepoint * Treatment + baseline, data = your_data,            correlation = corSymm(form = ~ 1 | Subject),           weights = varIdent(form = ~ 1 | Timepoint)) ``