[R] Within Subject ANOVA question

Mike Lawrence Mike.Lawrence at dal.ca
Tue Jun 2 04:33:35 CEST 2009


str() is again your friend.

> str(asummary)
List of 2
 $ Error: subject          :List of 1
  ..$ :Classes ‘anova’ and 'data.frame':	1 obs. of  5 variables:
  .. ..$ Df     : num 9
  .. ..$ Sum Sq : num 943
  .. ..$ Mean Sq: num 105
  .. ..$ F value: num NA
  .. ..$ Pr(>F) : num NA
  ..- attr(*, "class")= chr [1:2] "summary.aov" "listof"
 $ Error: subject:condition:List of 1
  ..$ :Classes ‘anova’ and 'data.frame':	2 obs. of  5 variables:
  .. ..$ Df     : num [1:2] 2 18
  .. ..$ Sum Sq : num [1:2] 52.3 11.1
  .. ..$ Mean Sq: num [1:2] 26.133 0.615
  .. ..$ F value: num [1:2] 42.5 NA
  .. ..$ Pr(>F) : num [1:2] 1.52e-07 NA
  ..- attr(*, "class")= chr [1:2] "summary.aov" "listof"
 - attr(*, "class")= chr "summary.aovlist"

So asummary is a list, each element of which contains yet another list
which in turn contains a single data frame element. So,

asummary[[2]][[1]]$'F value'[1]

gives you the F value of the condition effect.


On Mon, Jun 1, 2009 at 9:12 PM, tsunhin wong <thjwong at gmail.com> wrote:
> As another follow-up related to aov, I want to extract values
> (Residual interaction mean square & interaction DF) from the results:
> asummary<-summary(aov.recall)
> The results are in a list() format with 3 lists, and contents within
> each list are without "names".
>
> I am not able to do something like in other statistics such as in t.test:
>>as.numeric(t.test(serie1,serie2,na.rm=TRUE)$statistic)
>
> What method should I use to extract, or is it simpler to write compute
> the figures that I need directly in this case?
> Thanks a lot!
>
> - John
>
> On Mon, Jun 1, 2009 at 7:08 PM, Mike Lawrence <Mike.Lawrence at dal.ca> wrote:
>> On Mon, Jun 1, 2009 at 7:50 PM, tsunhin wong <thjwong at gmail.com> wrote:
>>> But I have some follow-up questions:
>>> 1. In aov, why IVs (subject & condition) cannot be in number format?
>>
>> Put simply, because that's the only way to obtain the values you
>> observe in the paper you're reading. :Op  Factorizing tells the ANOVA
>> that the labels associated with each level of the factor aren't really
>> meaningful. This is particularly evident in the case of Subject
>> numbers, which (typically) have no numeric interpretation (Ss #6 is
>> not 2 times Ss #3). The original authors' choice to treat condition as
>> a factor was a less clear choice given that it clearly refers to a
>> measurable ratio quantity (seconds). I presume the paper to which
>> you're referring is the Masson & Loftus 1994 paper (be sure to read
>> their 2003 follow-up and 2004 correction). In that case the authors
>> come from a field where it's commonplace to treat even ratio
>> independent variables as factored.
>>
>>> 2. Why I need to use factor() on IVs (subject & condition) but I
>>> cannot use factor() on DV (recall)?
>>
>> As noted above, factoring prohibits R from interpreting the labels of
>> a value as numerically meaningful, something you surely do not want to
>> do with your DV in this example.
>>
>>
>> --
>> Mike Lawrence
>> Graduate Student
>> Department of Psychology
>> Dalhousie University
>>
>> Looking to arrange a meeting? Check my public calendar:
>> http://tr.im/mikes_public_calendar
>>
>> ~ Certainty is folly... I think. ~
>>
>



-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University

Looking to arrange a meeting? Check my public calendar:
http://tr.im/mikes_public_calendar

~ Certainty is folly... I think. ~




More information about the R-help mailing list