Thank you David and Rich for your reply.
I will try to get more concrete with an artificial example that replicates
the structure of the data sets I'm analyzing.
It will include analysis suggestions based on what I was able to figure out
from the demo(MMC.apple).
At the end there is my current puzzlement, if the logic of the analyses I
suggest is correct:

## For creating an artifical data set:
# Trial-number: 31 trials per (pt-)block, repeated for 2 blocks per each of
10 human subjects
tn=rep(1:31, times=20)
# Presentation type: 2 blocks of 31 trials for each of 10 human subjects
pt.1=rep(c('C','D'), each=31)
pt=rep(pt.1, times=10)
# The 10 subjects can be divided into 2 groups (of 5 each), distinct in
presentation order
grp.1=rep('DC', times=62*5)
grp.2=rep('CD', times=62*5)
grp=c(grp.1,grp.2)
# Ten subjects, each going through 2 (pt-)blocks of 31 trials each
s=rep(1:10, each=62)
# For the sake of the example we can randomly create a random vector of
results:
r=runif(620)

dat=data.frame("subj"=factor(s),"group"=factor(grp),
"present.type"=factor(pt),
  "trial.num"=tn, "res.v"=r)

## The analysis dilema:
# I would like to look at the interaction between the two factors,
# alleviating the variance due to trial repeation within each block.
# That is, to have trial.num as a covariate.

# "simply" matching my case to the example in demo(MMC.apple), from the HH
package, will be:
m.simple=aov(res.v ~ present.type + group + trial.num, data=dat, x=TRUE)
# and the coding for trial.num in the model=matrix is an integer:
m.simple$x[1:10,]
# (which means it is treated as a continuous var?)

# But, actually, in my case, present.type is repeated for each subj and
# trial.num is repeated for each level of present.type.
# So I figured the model should be:
m.mixed=aov(res.v ~ present.type * group * trial.num +
  Error(subj/(present.type + (present.type/trial.num))),
  data=dat, x=TRUE)
# but now I cannot get the model matrix:
m.mixed$x[1:10,] # == NULL

# and when I compare a reduced model, not including the covariate-trial.num:
m.mixed.red=aov(res.v ~ present.type * group +
  Error(subj/present.type),
  data=dat, x=TRUE)
# I get the same results for the factors, which means that including the
covariate-var (trial.num)
# in this way does not affect the evaluation of the other factors.


# So, what I wonder now is why including trial.num does not affect the
results for the other factors,
# and is there a way to use such a covariate to remove any "masking" it can
induce on the effects
# of interest.

# (To explain a bit what I'm expecting:
# intuitively I understand that there is variance in the res.v that is due
to the covariate-var
# which is not related to, and so can not be explained by, the factors of
interest.
# So, efectively, it inflates the noise-variance that serve to evaluate the
significance
# of the variance-of-interest
# - I hope that by removing (some of) this covariance-var related
noise-variance
# I will be able to get effects evaluations that are more "purely" related
to the res.v
# - increasing the levels of significance where there is actual effect)

Thank you for any further help.
dror

----------------------------------

On Sun, Dec 26, 2010 at 9:45 PM, RICHARD M. HEIBERGER <rmh@temple.edu>wrote:

> Dror,
>
> Please look at the
> demo(MMC.apple)
> in the HH package
>
> install.packages("HH") ## if you don't already have it.
> library(HH)
> demo(MMC.apple)
>
> Please reply to the list if there are further queries.
>
> Rich
>
> On Sun, Dec 26, 2010 at 7:42 AM, Dror D Lev <dror.teach@gmail.com> wrote:
>
>> Dear r helpers,
>>
>> I would like to look at the interaction between two two-level factors, one
>> between and one within participants, after accounting for any variance due
>> to practice (31 trials in each of two blocks) in the task.
>> It seems to require treating practice as a covariate.
>>
>> All the examples I noticed for handling covariates (i.e. ANCOVA, including
>> the ones in Faraway's "Practical regression and anova using r") use lm(),
>> but this doesn't handle repeated-measures.
>>
>> I thought of a solution in the form of first running a regression on the
>> covariate:
>> > cov.accnt = lm (myMeasure ~ myCovMeasure, data=dat)
>>
>> and then run the aov() on the residuals:
>> > m.aov = aov (cov.accnt$residuals ~ withinVar*betweenVar +
>> Error(subj/withinVar, data=dat)
>>
>> Does it seem to be a valid answer to my problem?
>>
>> Is there an existing function that can do this (perhaps more
>> appropriately)?
>>
>> Thank you for any help,
>> dror
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>

	[[alternative HTML version deleted]]

