[R] Regarding anova result
S Ellison
S.Ellison at lgc.co.uk
Fri May 9 11:34:32 CEST 2008
>>> "Guru S" <guru.rcom at rediffmail.com> 09/05/2008 08:18 >>>
>I fitted tree growth data with Chapman-Richards growth function using
nls.
>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 =
0.54321),
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}}
More information about the R-help
mailing list