Reputation: 499
I am currently receiving this error message from the following data set when I run the anova
function: summary(aov(Site~Chlo,data=alldata))
. The data set is saved under a txt file.
Error in levels(x)[x] : only 0's may be mixed with negative subscripts
In addition: Warning messages:
1: In model.response(mf, "numeric") :
using type = "numeric" with a factor response will be ignored
2: In Ops.factor(y, z$residuals) : - not meaningful for factors
Year Site Chlo DAC PARD SST
2003 Seych 2.95 0.24 -39.36 0.40
2003 Brazil -2.35 -0.14 22.97 4.03
2003 Indo 0.42 0.04 6.82 0.60
2004 Seych 0.20 0.02 -2.30 -0.63
2004 Brazil -0.22 -0.01 -10.28 -1.22
2004 Indo 0.32 0.03 15.82 -1.72
Is there a reason behind this?
Upvotes: 0
Views: 5280
Reputation: 132706
I assume you want test whether Chlo
is different between Site
s. So Chlo
belongs on the LHS and Site
on the RHS in the formula. With your data:
DF <- read.table(text="Year Site Chlo DAC PARD SST
2003 Seych 2.95 0.24 -39.36 0.40
2003 Brazil -2.35 -0.14 22.97 4.03
2003 Indo 0.42 0.04 6.82 0.60
2004 Seych 0.20 0.02 -2.30 -0.63
2004 Brazil -0.22 -0.01 -10.28 -1.22
2004 Indo 0.32 0.03 15.82 -1.72", header=TRUE)
summary(aov(Chlo~Site, data=DF))
# Df Sum Sq Mean Sq F value Pr(>F)
#Site 2 8.247 4.124 2.043 0.275
#Residuals 3 6.055 2.018
So, it's not significantly different, but if n is that small there isn't much power and conducting an ANOVA doesn't really make sense.
Upvotes: 1