[R] Question about R^2 in nonlinear models
Douglas Bates
bates at stat.wisc.edu
Thu Mar 27 21:42:57 CET 2003
Spencer Graves <spencer.graves at pdf.com> writes:
> R^2 = 1 - var(residuals)/var(y)
>
> Note, however, that one can get R^2 < 0, e.g., with a straight line
> through the origin. If "nlme" does not automatically report R^2, this
> may be why.
Neither nls nor the nonlinear model fitting functions from the nlme
package report an R^2 value because this statistic doesn't always make
sense for a nonlinear model. R^2 for a linear model is a way of
comparing the fitted model to a trivial model that predicts all the
responses by a constant. If there is a constant term in the linear
model formula (and this can be detected) then the constant model will
be nested within the fitted model. For a nonlinear model it would be
difficult to determine if the constant model is nested within the
fitted model. In many cases it is not and an R^2 value would be very
difficult to interpret - some might even say meaningless.
If you really want an R^2 value you could use SAS PROC NLIN which
*always* produces an ANOVA table and the R^2 value, even when it is
meaningless :-).
More information about the R-help
mailing list