[R] reading the results of a within subject test
Stephen Ellison
stephen.ellison at lgcgroup.com
Fri Jun 24 02:06:31 CEST 2011
>From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of Ann [trivialescape at gmail.com]
>Subject: [R] reading the results of a within subject test
>
>Hi, I ran the following in R (on item means):
>
> aov(VAR ~(a*b)+Error(item/(a*b)), data = item)
>
> ....
> I'm confused...
Could you say more about what 'item' in 'data=item' is? The data= argument is usually a data frame which would normally (for your model specification) contain a continuous variable 'VAR', and probably categorical variables (factors) a, b and item. It is possible to have a data fram called item containing a variable called item, but I'm not quite sure that's what you have.
Assuming that you have - or at least hoping so, 'cos I can't see how the model would work properly otherwise - you seem to have specified a two-way anova with interactions against fixed effect factors a and b, (with a*b expanding to a, b and a:b) and an Error term which effectively says you want to test your a, b and a:b fixed effects against random effects a, b and a:b (from the a*b) nested within Item, so expanding to item:a, item:b and item:a:b. That is why you got all those extra tables. But that sounds a bit unlikely. Most experimenters either nest items in a:b subgroups (ie observing several different items for each a:b group) or, for blocked designs, use all combinations of a:b treatments on every one of a number of different items (obviously hard to do unless the treatments are reversible - an example might be experiments like reversible exterior temperature/pressure effects on, say, flow meter readings).
I'd guess the more likely scenario is that you have multiple different items per a:b group. That would require only one error term - item, uniquely identified perhaps as a:b:item or simply as item if the items are already individually labelled.
But you also say 'on the item means'. Asking for item as an error term implies that you have residual error within item. You clearly can't see that if you only supply item means (which may be one reason aov warned you that you had a singular model - that last table would have been seeking to calculate the residual variance, and after the item means were taken out, there wan't any residual variance). If you had a nested model (multiple different items per a:b subgroup), _either_ you should have provided the raw observations (and not the means) and specified Error(item) or Error(a:b:item) for which aov() would give you a table of tests against the residual MS and another table with tests against the item MS (the latter being the more sensible of the two if items are random and appreciably different), _or_ you should supply the item means, in which case you need not include item in the model because the variation between item means within each group is simply the residual error.
Admittedly I'm speculating quite a bit on what experiment you've actually done, but with a bit of luck some of the above will give you a clue...
*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}
More information about the R-help
mailing list