[R] Doubt about aov and lm function... bug?
Jose Claudio Faria
joseclaudio.faria at gmail.com
Wed Apr 8 22:16:08 CEST 2009
Hi,
The below very strange:
# a) aov function
av <- aov(Sepal.Length ~ Species, data=iris)
# Error in parse(text = x) :
# unexpected symbol in "Sepal(Sepal.Length+Species)Length"
av <- aov(iris[, 1] ~ iris[, 5])
# summary(av)
# Df Sum Sq Mean Sq F value Pr(>F)
# iris[, 5] 2 63.2 31.6 119 <2e-16 ***
# Residuals 147 39.0 0.3
# ---
# Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# b) lm function
lm1 <- lm(Sepal.Length ~ Sepal.Width, data=iris)
# Error in parse(text = x) :
# unexpected symbol in "Sepal(Sepal.Length+Sepal.Width)Length"
lm1 <- lm(iris[, 1] ~ iris[, 2])
summary(lm1)
# Call:
# lm(formula = iris[, 1] ~ iris[, 2])
#
# Residuals:
# Min 1Q Median 3Q Max
# -1.556 -0.633 -0.112 0.558 2.223
#
# Coefficients:
# Estimate Std. Error t value Pr(>|t|)
# (Intercept) 6.526 0.479 13.63 <2e-16 ***
# iris[, 2] -0.223 0.155 -1.44 0.15
# ---
# Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#
# Residual standard error: 0.82 on 148 degrees of freedom
# Multiple R-squared: 0.0138, Adjusted R-squared: 0.00716
# F-statistic: 2.07 on 1 and 148 DF, p-value: 0.152
I'm wrong or is it a bug?
platform i386-pc-mingw32
arch i386
os mingw32
system i386, mingw32
status Patched
major 2
minor 8.1
year 2009
month 01
day 22
svn rev 47680
language R
version.string R version 2.8.1 Patched (2009-01-22 r47680)
Thanks,
--
///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\
Jose Claudio Faria
Estatistica - prof. Titular
UESC/DCET/Brasil
joseclaudio.faria at gmail.com
joseclaudio.faria at terra.com.br
///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\
More information about the R-help
mailing list