[R] Anova
John Fox
jfox at mcmaster.ca
Fri Oct 5 12:24:23 CEST 2012
Dear Jean,
On Fri, 5 Oct 2012 01:27:55 -0700 (PDT)
Jhope <jeanwaijang at gmail.com> wrote:
> Hi R-listers,
>
> I am trying to do an ANOVA for the following scatterplot and received the
> following error:
>
> library(car)
> scatterplot(HSuccess ~ Veg,
> data = data.to.analyze,
> xlab = "Vegetation border (m)",
> ylab = "Hatching success (%)")
>
> anova(HSuccess ~ Veg, data=data.to.analyze)
>
> Error in UseMethod("anova") :
> no applicable method for 'anova' applied to an object of class "formula"
>
> I am wondering if there is a better way to do this?
anova() needs a model object, not a formula, as its first argument:
anova(lm(HSuccess ~ Veg, data=data.to.analyze))
Alternatively, you can use aov(), with summary(), to get the ANOVA table:
summary(aov(HSuccess ~ Veg, data=data.to.analyze))
I hope this helps,
John
------------------------------------------------
John Fox
Sen. William McMaster Prof. of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/
> Please advise, Jean
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Anova-tp4645130.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
More information about the R-help
mailing list