Dear All,
I am attempting to use R to perform an ANOVA with three factors:
feature (3 levels), group (5 levels), and patient (246 levels), where
patient is nested within group.
Currently I am using the "lm" function to fit the model, with the
following form:
fit <- lm(intensity ~ feature + group + feature:group + group/patient,
data = new)
I have two questions:
1. I'd like to use a contrast to estimate a model-based average
intensity for a particular patient. In my attempts to do this so far,
I've tried to use the "estimable" function, but I've found that I
would need to specify a value ('0' or '1') for each level of patient.
Since there are 246 patients, this is time consuming and requires a
long piece of code. Do you recommend an R function that might
accomplish this task more efficiently than "estimable"?
2. I'd also like to specify a separate error variance for each level
of feature. I've read documentation on several functions, and it
seems like I might need to use the "weights" command within the "lme"
function for this. However, I have no random effects (even though
patient might be considered random I'd prefer to keep it fixed for
now) and running lme gives me an error: "Invalid formula for
groups". Is there a more appropriate function to be using that will
easily allow for feature-specific error variances?
Any advice is appreciated,
Tim
______________________________________________
R-help@r-project.org 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.