Skip to content

Anova

4 messages · Jhope, Rui Barradas, John Fox

#
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:
#
Dear Jean,

On Fri, 5 Oct 2012 01:27:55 -0700 (PDT)
Jhope <jeanwaijang at gmail.com> wrote:
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/
#
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
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)
Error: could not find function "pvals.fnc"
--
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.