Dear R users,
I have a data structure as follows:
id two res1 res2 c1 c2 inter
1 -0.786093166 1 0 1 2 6
3 -0.308495749 1 0 0 1 2
5 -0.738033048 1 0 0 0 1
7 -0.52176252 1 0 1 0 4
9 -2.023641189 1 0 1 1 5
10 0.463469887 1 0 1 0 4
14 0.379364681 1 0 1 0 4
17 -1.422889721 1 0 0 0 1
19 -2.582340053 1 0 0 2 3
20 0.721793018 1 0 1 2 6
1 -0.867823661 0 1 1 2 6
3 -0.727418536 0 1 0 1 2
5 -0.331731368 0 1 0 0 1
7 -0.835913405 0 1 1 0 4
9 -0.612541616 0 1 1 1 5
10 -0.063685221 0 1 1 0 4
14 0.3511481 0 1 1 0 4
17 -1.3847698 0 1 0 0 1
19 -2.232306187 0 1 0 2 3
20 0.0014117 0 1 1 2 6
I would like to apply multivariate analysis and test interaction effect in
the same model by using lme function. The 'two' variable is a bi-variate
outcome by combining two continuous outcomes. The 'res1' and 'res2' are two
dummy variables to flag these two outcome variables, separately. The
interaction term for c1 and c2 is "inter" with 6 levels. What I have done
are as follows:
# capture clustering structure
tmp <- groupedData(two~res1+res2+inter|id,data=a); tmp <- na.exclude(tmp);
# treat 'inter' as a multi-level variable
options(contrasts=c(factor="contr.treatment",ordered="contr.poly"));
tmp$inter <- factor(tmp$inter); contrasts(tmp$inter)
# perform multivariate analysis and test interaction effect
m1 <- summary(lme(two~res1+res2+inter, random=~1|id, data=tmp))
## Error in MEEM(object, conLin, control$niterEM) :
## Singularity in backsolve at level 0, block 1
Unfortunately, I have been unable to get it work. If I removed these two
dummy variables like this:
m2 <- summary(lme(two~inter, random=~1|id, data=tmp))
I did get some outputs, but these outputs in the model m2 were wrong. Is
there any way to perform multivariate analysis and test interaction effect
(a multi-level factor) in the same model by lme? In addition, can lme be
used for multivariate analyses of combining several binary outcome
variables? Or it may be doable in some R function?
Many thanks for your suggestions.
Hui-Ju
The contents of this e-mail message and any attachments are private and
confidential communications intended solely for the addressee(s) named in this
message. If you are not the intended recipient of this message, please 1)
immediately notify the sender by reply e-mail and then delete this message and
its attachments and 2) do not read, use, distribute disclose or copy this
message and/or any attachments.
[[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.