nlsResiduals: NLS residuals

Description Usage Arguments Details Value Author(s) References Examples

Description

Provides several plots and tests for the analysis of residuals

Usage

1
2
3
4
5
6
7
8
9
nlsResiduals (nls)
## S3 method for class 'nlsResiduals'
 plot(x, which = 0, ...)



test.nlsResiduals (x)
## S3 method for class 'nlsResiduals'
 print(x, ...)

Arguments

nls

an object of class 'nls'

x

an object of class 'nlsResiduals'

which

an integer:
0 = 4 graphs of residuals (types 1, 2, 4 and 6)
1 = non-transformed residuals against fitted values
2 = standardized residuals against fitted values
3 = sqrt of absolute value of standardized residuals against fitted values
4 = auto-correlation residuals (i+1th residual against ith residual)
5 = histogram of the residuals
6 = qq-plot of the residuals

...

further arguments passed to or from other methods

Details

Several plots and tests are proposed to check the validity of the assumptions of the error model based on the analysis of residuals.
The function plot.nlsResiduals proposes several plots of residuals from the nonlinear fit: plot of non-transformed residuals against fitted values, plot of standardized residuals against fitted values, plot of square root of absolute value of standardized residuals against fitted values, auto-correlation plot of residuals (i+1th residual against ith residual), histogram of the non-transformed residuals and normal Q-Q plot of standardized residuals.
test.nlsResiduals tests the normality of the residuals with the Shapiro-Wilk test (shapiro.test in package stats) and the randomness of residuals with the runs test (Siegel and Castellan, 1988). The runs.test function used in nlstools is the one implemented in the package tseries.

Value

nlsResiduals returns a list of five objects:

std95

the Student value for alpha=0.05 (bilateral) and the degree of freedom of the model

resi1

a matrix with fitted values vs. non-transformed residuals

resi2

a matrix with fitted values vs. standardized residuals

resi3

a matrix with fitted values vs. sqrt(abs(standardized residuals))

resi4

a matrix with ith residuals vs. i+1th residuals

Author(s)

Florent Baty florent.baty@gmail.com
Marie-Laure Delignette-Muller ml.delignette@vetagro-sup.fr

References

Bates DM and Watts DG (1988) Nonlinear regression analysis and its applications. Wiley, Chichester, UK.

Siegel S and Castellan NJ (1988) Non parametric statistics for behavioral sciences. McGraw-Hill international, New York.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Plots of residuals
data(growthcurve4)
nls1 <- nls(gompertzm, growthcurve4,
	list(lag = 10,mumax = 0.1, LOG10N0 = 6, LOG10Nmax = 9))
nr <- nlsResiduals(nls1)
plot(nr, which = 0)

# Histogram and qq-plot
plot(nr, which=5)
plot(nr, which=6)
	
# Tests
test.nlsResiduals(nr)

nlstools documentation built on May 2, 2019, 5:49 p.m.