# Re: [R] Regarding anova result

From: Guru S <guru.rcom_at_rediffmail.com>
Date: Fri, 09 May 2008 10:13:50 +0000

Hi S Ellison,

you said anova in R works two ways;
one is single fit, another one is sequence of fits. Single fit is used to fit single nls() model result. If I am wrong plz advice me.  I want to use single fit. How to do that? In your example, why the anova(y.nls1) is generating error? How to get anova result for "anova(y.nls1)" Thanks in advance,
With Regards,
Guru S

On Fri, 09 May 2008 S Ellison wrote :
>
>
> >>> "Guru S" <guru.rcom@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, 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, copying or
>disclosure other than by the intended recipient is unauthorised. If
>immediately via +44(0)20 8943 7000 or notify postmaster_at_lgc.co.uk
>and delete this message and any copies from your computer and network.
>LGC Limited. Registered in England 2991879.
>Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK

[[alternative HTML version deleted]]

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. Received on Fri 09 May 2008 - 10:19:57 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 - 11:30:36 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.