Dear list,
I'm trying to fit a multilevel (mixed-effects) model using the lme function
(package nlme) in R 2.4.0. As a mixed-effects newbie I'm neither sure about
the modeling nor the correct R syntax.
My data is structured as follows: For each subject, a quantity Y is measured
at a number (>= 2) of time points. Moreover, at time point 0 ("baseline"), a
quantity X is measured for each subject (I am interested to see whether X,
or log(X), is a predictor of Y). I saw in some examples that time-invariant
predictors should be repeated for all rows of a subject, which is why I
copied the baseline value of X also to time points > 0. The resulting data
frame looks like this:
Grouped Data: Y ~ TIME | Subject
Y TIME Subject X.Baseline
9 0.0 1 1084
7 3.7 1 1084
11 0.0 2 7150
8 9.2 2 7150
Intra-subject trajectories of Y very close to linear. I'd like to check
whether slope (and maybe also offset) of this line are (in part) predicted
by X.baseline.
Thus, I think the multilevel model specification should be as follows (i =
subject, j=measurement):
y_ij = \beta_i + b_i * TIME_ij + \epsilon_ij,
with
b_i = \zeta_i0 + \zeta_i1 * X.Baseline
Is this correct?
Now, I am completely unsure how to "translate" this into the syntax needed
by lme.
Is there any standard procedure on how to get from e.g. the Laird&Ware'82
matrix model notation to the lme input?
And, in my case, is the correct model as follows, or am I wrong?
my.model <- lme( Y ~ TIME, my.data.frame, random=~X.Baseline | Subject )
[in case this is correct, it is by accident, since I made it up from some
examples I found without really understanding the translation from the model
formulation]
I'd greatly appreciate some advice or help.
Best,
Lukas
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.