Learn R Programming

analogue (version 0.4-0)

residuals.bootstrap.mat: Extract Bootstrapped Model Residuals

Description

residuals is a generic function which extracts model residuals from objects returned by modeling functions. residuals.bootstrap.mat is a residuals method for mat models.

The abbreviated form of this function is resid.

Usage

## S3 method for class 'bootstrap.mat':
residuals(object, which = c("model", "bootstrap"), ...)

Arguments

object
an object of class bootstrap.mat.
which
character; which set of residuals to return, the model residuals or the residuals of the bootstrap-derived estimates?
...
arguments pass to or from other methods.

Value

  • A list containg the requested residuals and metadata, with the following components:
  • modelLeave one out residuals for the MAT-estimated model.
  • bootstrapresiduals for the bootstrapped MAT model.
  • knumeric; indicating the size of model used in estimates and predictions.
  • n.bootnumeric; the number of bootstrap samples taken.
  • autological; whether "k" was choosen automatically or user-selected.
  • weightedlogical; whether the weighted mean was used instead of the mean of the environment for k-closest analogues.

Details

Typical usages are resid(object, which = c("model", "bootstrap"), \dots)

See Also

residuals, mat, bootstrap.mat.

Examples

Run this code
## continue the RLGH example from ?join
example(join)

## fit the MAT model using the squared chord distance measure
swap.mat <- mat(swapdiat, swappH, method = "SQchord")

## bootstrap training set
swap.boot <- bootstrap(swap.mat, k = 10, n.boot = 100)

## residuals
resid(swap.boot) # uses abbreviated form

Run the code above in your browser using DataLab