I have a model something like this:
lmer(y ~ factor(month) + x + (1|subject))
Where month represents repeated measures of y. The
x variable is fixed-per subject.
x is an aggregate of multiple measurements taken before the main experiment started, and these are unbalanced. For some subjects
x is based on 2 observations, but for others it's based on as many as 30.
Is there any way to include uncertainty in the measurement of
x in the main model without re-running this as some kind of SEM?
EDIT: I've just discovered this is called an errors-in-measurement model, and is possible using the
brms package, which in turn relies on Stan (see https://github.com/paul-buerkner/brms/issues/114). If there is a simpler way to run these models without resorting to MCMC I'd still be interested though.