[R] Error in ANOVA for model comparison

Rosario Garcia Gil M.Rosario.Garcia at slu.se
Fri Jan 21 15:30:36 CET 2011


Hello

I am trying to compare two models using anova(), however I get a message error (see below).
In the net I only found some information on certain library(car) for which one should use anova with A capital letter (Anova instead of anova), but I could not find car library as it says it does not exist.


> Model <- lm(interceptG ~ SW + TSC + FSC + PF + SlopeG + K, data=AllTrait)
> Model1 <- lm(interceptG ~ SW + TSC + FSC + PF + SlopeG + PHt, data=AllTrait)

Error in anova.lmlist(object, ...) : 
  models were not all fitted to the same size of dataset

I have NA in the datafile, should that be the problem?

Kind regards and thanks in advance
Rosario


More information about the R-help mailing list