I am trying to fit a linear mixed effect model to longitudinal haemoglobin (Hb) count data from a two-arm clinical trial. A subset of the data in long form is shown below:
pid site arm pday Hb pday2 I
1 MOB2004_001 Boane SP 0 8.5 0 0
2 MOB2004_001 Boane SP 3 8.0 9 0
3 MOB2004_001 Boane SP 7 8.9 49 1
4 MOB2004_001 Boane SP 14 8.9 196 1
5 MOB2004_002 Boane SP 0 11.5 0 0
6 MOB2004_002 Boane SP 3 9.1 9 0
The figure attached shows the mean response curves for the observations partitioned by study arm. The shape of the curve is such that I would like to model a quadratic relationship between haemoglobin and time, with different parameters for the curve before a knot at day 3. To this extent, I created an indicator variable 'I' which is zero when day < 3 and one otherwise. The objective is to assess differences between the study arms and thus a studyarm-day interaction is necessary too.
I have thus specified this model as:
lme(data=dat.mod2, fixed=Hb~ arm*pday + pday*I + pday2 +
pday2*I , random=~1|site/pid, na.action = na.omit)
The problem occurs when trying to fit this model, I get the error:
Error in MEEM(object, conLin, control$niterEM) : Singularity in backsolve at level 0, block 1
I see that this is a multicollinearity error, but I don't understand why it is occurring in this case.
I am aware that there are other ways to model this but want to use linear mixed effect models first. Would really appreciate any ideas on how to specify this model correctly.
I have tried different model specifications and all seem to work unless both pday*I
and pday2*I
are included. The model fits when I have either pday*I
or pday2*I
as fixed effects, but not with both. This is not great because I would like to estimate quadratic terms for both before and after the knot, and do not want to smooth over these.
I tried to fit with lmer in lme4 but I get the rank deficient error.