Description Usage Arguments Details Value Author(s) References Examples
Provides several plots and tests for the analysis of residuals
1 2 3 4 5 6 7 8 9 |
nls |
an object of class 'nls' |
x |
an object of class 'nlsResiduals' |
which |
an integer: |
... |
further arguments passed to or from other methods |
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
.
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 |
Florent Baty florent.baty@gmail.com
Marie-Laure Delignette-Muller ml.delignette@vetagro-sup.fr
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.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.