R2nls: Coeficient of Determination for Non Linear Regression Models

Description Usage Arguments Value Author(s) Examples

View source: R/R2nls.R

Description

This function returns the anova table with the partition of the total sum of squares into due the regression model and residuals and the corresponding R^2 (adjusted for the null model).

Usage

1
R2nls(nls.obj)

Arguments

nls.obj

a object of class nls.

Value

a list with two slots. The first named anova is the table with partition of the total sum of squares (adjusted for the mean or null model or intercept inly model) in regression sum of squares and residual sum of squares. The second named R2 is the coefficient of determination.

Author(s)

Walmes Zeviani, walmes@ufr.br

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
da <- subset(DNase, Run == 4)
plot(density ~ log(conc), data = da)

m0 <- nls(density ~ Asym/(1 + exp(-(log(conc) - xmid)/scal)),
          start = list(Asym = 2.3, xmid = 1.5, scal = 1),
          data = da)
summary(m0)

plot(density ~ log(conc), data = da)
with(as.list(coef(m0)),
     curve(Asym/(1 + exp(-(x - xmid)/scal)),
           add = TRUE, col = 2))

R2nls(m0)
cor(fitted(m0), da$density)^2

walmes/wzRfun documentation built on Aug. 10, 2021, 2:19 p.m.