Learn R Programming

nlstools (version 2.1-0)

nlsContourRSS: Surface contour of RSS

Description

Provides residual sum of squares (RSS) contours

Usage

nlsContourRSS (nls, lseq = 100, exp = 2)
  # S3 method for nlsContourRSS
plot (x, nlev = 0, col = TRUE, col.pal = terrain.colors(100), 
                                ask = FALSE, useRaster = TRUE, ...)
  # S3 method for nlsContourRSS
print (x, ...)

Value

nlsContourRSS returns a list of three objects:

seqPara

a matrix with the sequence of grid values for each parameter

lrss

a list of matrices with logarithm values of RSS in the grid for each pair of parameters

lrss95

the logarithm of the 95 percent residual sum of squares threshold according to Beale (1960)

Arguments

nls

an object of class 'nls'

lseq

length of the sequences of parameters

exp

expansion factor of the parameter intervals defining the grids

nlev

number of contour levels to add to the likelihood contour at level 95 percent

col

logical. Contours are plotted with colors if TRUE

col.pal

Palette of colors. Colors to be used as background (default is terrain.colors(100); unused if col is FALSE)

x

an object of class 'nlsContourRSS'

ask

if TRUE, draw plot interactively (default is FALSE)

useRaster

a bitmap raster is used to plot the image instead of polygons (default is TRUE)

...

further arguments passed to or from other methods

Author

Florent Baty, Marie-Laure Delignette-Muller

Details

The aim of these functions is to plot the residual sum of squares (RSS) contours which correspond to likelihood contours for a Gaussian model. For each pair of parameters the RSS is calculated on a grid centered on the least squares estimates of both parameters, the other parameters being fixed to their least square estimates. The contours of RSS values are then plotted for each pair of parameters. For each pair of parameters, one of this contour corresponds to a section of the 95 percent Beale's confidence region in the plane of these parameters. This contour is plotted in a different color.

References

Beale EML (1960) Confidence regions in non-linear estimations. Journal of the Royal Statistical Society, 22B, 41-88.

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

Examples

Run this code
formulaExp <- as.formula(VO2 ~ (t <= 5.883) * VO2rest + (t > 5.883) * 
                        (VO2rest + (VO2peak - VO2rest) * 
                        (1 - exp(-(t - 5.883) / mu))))
O2K.nls1 <- nls(formulaExp, start = list(VO2rest = 400, VO2peak = 1600, 
                mu = 1), data = O2K)
O2K.cont1 <- nlsContourRSS(O2K.nls1)
plot(O2K.cont1)

Run the code above in your browser using DataLab