[R] "1 observation deleted due to missingness" from summary() on the result of aov()
David Winsemius
dwinsemius at comcast.net
Tue Feb 9 05:42:19 CET 2010
On Feb 8, 2010, at 10:28 PM, bluesky315 at gmail.com wrote:
> I have the R code at the end. The last command gives me "1 observation
> deleted due to missingness". I don't understand what this error
> message. Could somebody help me understand it and how to fix the
> problem?
>
>> summary(afit)
> Df Sum Sq Mean Sq F value Pr(>F)
> A 2 0.328 0.16382 0.1899 0.82727
> B 3 2.882 0.96057 1.1136 0.34644
> C 4 1.676 0.41897 0.4857 0.74617
> A:B 6 5.133 0.85554 0.9919 0.43404
> A:C 8 14.193 1.77406 2.0568 0.04543 *
> B:C 12 7.244 0.60366 0.6999 0.74896
> A:B:C 24 19.849 0.82705 0.9589 0.52442
> Residuals 119 102.642 0.86254
> ---
> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> 1 observation deleted due to missingness
>
>
> #######################
> a=3
> b=4
> c=5
>
> A=1:a
> B=1:b
> C=1:c
>
> n=3
>
> X=matrix(nr=a*b*c*n,nc=n)
> colnames(X)=LETTERS[1:n]
>
> for(i_a in 1:a-1) {
> for(i_b in 1:b-1) {
> for(i_c in 1:c-1) {
> for(i_n in 1:n-1) {
> X[((i_a * b + i_b) * c + i_c) * n + i_n + 1, ] = c(i_a+1, i_b
> +1, i_c+1)
> }
> }
> }
> }
which(is.na(aframe$Y) )
[1] 180
>
> set.seed(0)
> Y=matrix(nr=a*b*c*n,nc=1)
> for(i in 1:(a*b*c)) {
> for(i_n in 1:n-1) {
> fa=X[i,'A']
> fb=X[i,'B']
> fc=X[i,'C']
>
> #Y[(i-1)*n+i_n,1]= fa +fb +fc +fa*fb +fa*fc +fb*fc +fa*fb*fc +
> rnorm(1)
> Y[(i-1)*n+i_n,1]= rnorm(1)
> }
> }
>
> aframe = data.frame(
> A=as.factor(X[,'A'])
> , B=as.factor(X[,'B'])
> , C=as.factor(X[,'C'])
> , Y)
>
> afit=aov(Y ~ A * B * C, aframe)
>
> summary(afit)
>
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list