Re: [R] Regarding anova result

From: S Ellison <>
Date: Fri, 09 May 2008 10:34:32 +0100

>>> "Guru S" <> 09/05/2008 08:18 >>>
>I fitted tree growth data with Chapman-Richards growth function using
>When I try to run the anova() function I get this:
>Error in anova.nls(fit.nls) : anova is only defined for sequences of
"nls" objects

There seem to be two problems.
The first is that your summary is empty. I don't know why that is; you'd have to supply the nls() command and data. The second is exactly what the error message says; there is no anova method for a single nls object.
anova in R works two ways; on a single fit, in which case individual term sums of squares are calculated, or on a sequence of fits, in which case anova compares the SS for the different fits.

Using the example from the nls help:

 x <- 1:10

 y <- 2*x + 3                            # perfect fit
yeps <- y + rnorm(length(y), sd = 0.01) # added noise
y.nls1<-     nls(yeps ~ a + b*x, start = list(a = 0.12345, b =
         trace = TRUE)

y.nls2<-     nls(yeps ~ a + b*x+c*x^2, start = list(a = 0.12345, b =
0.54321, c=0.01),
         trace = TRUE)

anova(y.nls1) #Returns your error message

anova(y.nls1, y.nls2) #Returns a test of one fit against the other

Hope that helps

Steve E

This email and any attachments are confidential. Any use...{{dropped:8}} mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 09 May 2008 - 09:40:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 09 May 2008 - 10:30:37 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive