Hi, Steve: I'm on the opposite extreme: I don't know aov, and given that it is largely obsolete, I'm not too eager to learn it.
spencer graves Steven Lacey wrote: > Jacques, > > Thanks for the reply. I am not using lme because I don’t have the time to > understand how it works and I have a balanced design, so typcial linear > modelling in aov should be sufficient for my purposes. Down the road I plan > to learn lme, but I'm not there yet. So any suggestions with respect to aov > would be greatly appreciated. > > Steve > > -----Original Message----- > From: Jacques Veslot [mailto:[EMAIL PROTECTED] > Sent: Friday, April 21, 2006 11:58 AM > To: Steven Lacey > Cc: r-help@stat.math.ethz.ch > Subject: Re: [R] aov contrasts residual error calculation > > > > why not using lme() ? > > first, you need transform data: > dat2 <- as.data.frame(lapply(subset(dat, sel=-c(A,B,C)), rep, 3)) > dat2$y <- unlist(subset(dat, sel=c(A,B,C)), F, F) > > dat2$cond <- factor(rep(c("A","B","C"), each=nrow(dat))) > > dat2$inter <- factor(dat2$map):factor(dat2$cond) > > lme1 <- lme(fixed = y ~ mapping + cond + inter + other fixed effects, > random = ~ 1 |subj, data=dat2, > contrast=list(inter=poly(nlevels(dat2$inter)[,1:4])) > > > > > > > Steven Lacey a écrit : > >>Hi, >> >>I am using aov with an Error component to model some repeated measures >>data. By repeated measures I mean the data look something like this... >> >>subj A B C >>1 4 11 15 >>2 3 12 17 >>3 5 9 14 >>4 6 10 18 >> >>For each subject I have 3 observations, one in each of three >>conditions (A, B, C). I want to test the following contrast (1, 0, >>-1). One solution is to apply the contrast weights at the subject >>level explicitly and then call t.test on the difference scores. >>However, I am looking for a more robust solution as I my actual design >>has more within-subjects factors and one or more between subjects >>factors. >> >>A better solution is to specify the contrast in an argument to aov. >>The estimated difference of the contrast is the same as that in the >>paired t-test, but the residual df are double. While not what I >>expected, it follows from the documentation, which explicitly states >>that these contrasts are not to be used for any error term. Even >>though I specify 1 contrast, there are 2 df for a 3 level factor, and >>I suspect internally the error term is calculated by pooling across >>multiple contrasts. >> >>While very useful, I am wondering if there is way to get aov to >>calculate the residual error term only based on the specified >>contrasts (i.e., not assume homogeneity of variance and sphericity) >>for that strata? >> >>If not, I could calculate them directly using model.matrix, but I've >>never done that. If that is the preferred solution, I'd also >>appreciate coding suggestions to do it efficiently. >> >> >>How would I do the same thing with a two factor anova where one factor >>is within-subjects and one is between... >> Condition >>Mapping Subject A B C >>1 1 4 11 15 >>1 2 >>1 3 >>1 4 >>1 5 >>1 6 >>1 7 >>1 8 >>2 9 >>2 10 >> >>Mapping is a between-subject factor. Condition is a within-subject >>factor. There are 5 levels of mapping, 8 subjects nested in each level >>of mapping. For each of the 40 combinations of mapping and subject >>there are 3 observations, one in each level of the condition factor. >> >>I want to estimate the pooled error associated with the following set >>of 4 orthogonal contrasts: >> >>condition.L:mapping.L >>condition.L:mapping.Q >>condition.L:mapping.C >>condition.L:mapping^4 >> >>What is the best way to do this? One way is to estimate the linear >>contrast for condition for each subject, create a 40 row matrix where >>the measure for each combination of mapping and subject is the linear >>contrast on condition. If I pass this dataframe to aov, the mse it >>returns is the value I am looking for. >> >>If possible, I would like to obtain the estimate without collapsing >>the dataframe, but am not sure how to proceed. Suggestions? >> >>Thanks, >>Steve >> >>______________________________________________ >>R-help@stat.math.ethz.ch mailing list >>https://stat.ethz.ch/mailman/listinfo/r-help >>PLEASE do read the posting guide! >>http://www.R-project.org/posting-guide.html >> > > > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html