[R] aov() and NaN

Jan Malte Wiener jan.wiener at tuebingen.mpg.de
Fri Jul 5 12:46:58 CEST 2002


ripley at stats.ox.ac.uk wrote:
> aov does not.  It's na.action argument does.  It is dscribed on the help
> page for lm, which ?aov refers to.
> 
> BTW, missing values in R are not the same thing as NaNs, but for this
> purpose NaNs are treated as missing.
> 
> On Fri, 5 Jul 2002, Jan Malte Wiener wrote:
> 
> 
>>hi,
>>another anova question !!
>>how does aov() treat missing values ?
>>
>>since it might depend on my experimental design:
>>i have a within subject design with two factors ...
>>
>>i use aov() like this:
>>
>>aov(performance~type*block+Error(subj/(type+block)),data=anovaData)
>>
>>now it might happen that i have a couple of NaN data points in my result
>>dataFrame.
>>how can i know/control how aov() is treating those missing values ?
>>
>>greetinx jan


Yes, I tried using na.action=na.exclude (na.fail, na.omit).
obviously with na.fail I do not get any results, but with the other 
arguments I always get the same results, which are different from spss 
results
The results are not only different from spss, aov() behaves strange also 
(look at the "Error: subj:type" or "Error: subj:block" section ...)

summary(aov(perf~type*block+Error(subj/(type+block)), 
na.action=na.omit,data=anovaDataAllSubjCorrNav))


Error: subj
           Df  Sum Sq Mean Sq F value Pr(>F)
type       1 0.25032 0.25032  2.4855 0.1314
Residuals 19 1.91355 0.10071

Error: subj:type
           Df  Sum Sq Mean Sq F value Pr(>F)
type       1 0.03227 0.03227  0.3140 0.5818
block      1 0.15184 0.15184  1.4774 0.2391
Residuals 19 1.95268 0.10277

Error: subj:block
            Df  Sum Sq Mean Sq F value Pr(>F)
block       1 0.06253 0.06253  0.8086 0.3798
type:block  1 0.22826 0.22826  2.9520 0.1020
Residuals  19 1.46914 0.07732

Error: Within
            Df  Sum Sq Mean Sq F value Pr(>F)
type:block  1 0.00413 0.00413  0.0726 0.7892
Residuals  34 1.93538 0.05692


#####
for the section: "Error : subj:type" I get results for type and block 
factor ?? That I do not understand and that does not happen when having 
no NaN's -> see below !
######


 > print(summary(aov(perf~type*block+Error(subj/(type+block)),
na.action=na.omit, data=anovaDataAll)) )

Error: subj
           Df Sum Sq Mean Sq F value Pr(>F)
Residuals 24 2.9711  0.1238

Error: subj:type
           Df  Sum Sq Mean Sq F value Pr(>F)
type       1 0.00111 0.00111  0.0132 0.9096
Residuals 24 2.02667 0.08444

Error: subj:block
           Df  Sum Sq Mean Sq F value  Pr(>F)
block      1 0.21778 0.21778  4.3596 0.04759 *
Residuals 24 1.19889 0.04995
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1

Error: Within
            Df  Sum Sq Mean Sq F value Pr(>F)
type:block  1 0.01000 0.01000  0.2424 0.6269
Residuals  24 0.99000 0.04125




Thanks for comments on this,
Jan Wiener



-- 
Jan Malte Wiener
Max-Planck-Institute for Biological Cybernetics
Spemannstr. 38, 72076 Tuebingen, Germany
Tel.: +49 7071 601 631
Email: jan.wiener at tuebingen.mpg.de

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list