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? 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.
Hello, You're thinking of ?aov. anova() does _not_ have a formula interface, it would be anova(lm(HSuccess ~ Veg, data = data.to.analyze)) or aov(HSuccess ~ Veg, data = data.to.analyze) Hope this helps, Rui Barradas Em 05-10-2012 09:27, Jhope escreveu:> 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? > 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.
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.
Thank you for the replies. I am actually trying to gain p-values and f values, and tried the below script but unsuccessful. 1) I have read in another forum to use the package lmer but apparently it does not exist. 2) Then I tried the pvals.fnc but it is not a function. 3) I read also that a glm model must first be created but was not able to gain a P-value through summary but got F statistics. 4) Is there a way to get the P-value and F statistics? Or does this require two different executions? 5) I am afraid to update my R version because I may loose my ALL saved scripts, should I do so? Please advise, Jean> install.packages("lmer")Installing package(s) into ?/Library/Frameworks/R.framework/Versions/2.13/Resources/library? (as ?lib? is unspecified) Warning in install.packages : package ?lmer? is not available (for R version 2.13.1)> pvals.fnc(HSuccess ~ VegIndex, data = data.to.analyze)Error: could not find function "pvals.fnc"> Model1.glm <- glm(cbind(Shells, TotalEggs-Shells) ~ HTL, > data=data.to.analyze, family = binomial) > summary(Model1.glm)-- View this message in context: http://r.789695.n4.nabble.com/Anova-tp4645130p4645242.html Sent from the R help mailing list archive at Nabble.com.