wa {analogue}R Documentation

Weighted averaging transfer functions

Description

Implements the weighted averaging transfer function methodology. Tolerance down-weighting and inverse and classicial deshrinking are supported.

Usage

wa(x, ...)

## Default S3 method:
wa(x, env, deshrink = c("inverse", "classical"),
   tol.dw = FALSE, ...)

## S3 method for class 'formula':
wa(formula, data, subset, na.action,
   deshrink = c("inverse", "classical"), tol.dw = FALSE, model = FALSE, ...)

## S3 method for class 'wa':
fitted(object, ...)

## S3 method for class 'wa':
residuals(object, ...)

## S3 method for class 'wa':
coef(object, ...)

Arguments

x The species training set data
env The response vector
deshrink Which deshrinking method to use? One of "inverse" or "classical".
tol.dw logical; should species with wider tolerances be given lower weight?
formula a model formula
data an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables specified on the RHS of the model formula. If not found in data, the variables are taken from environment(formula), typically the environment from which wa is called.
subset an optional vector specifying a subset of observations to be used in the fitting process.
na.action a function which indicates what should happen when the data contain NAs. The default is set by the na.action setting of options, and is na.fail if that is unset. The 'factory-fresh' default is na.omit. Another possible value is NULL, no action. Value na.exclude can be useful.
model logical. If TRUE the model frame is returned.
object an Object of class "wa", the result of a call to wa.
... arguments to other methods.

Details

A typical model has the form response ~ terms whereresponse is the (numeric) response vector (the variable to be predicted) and terms is a series of terms which specifies a linear predictor for response. A terms specification of the form first + second indicates all the terms in first together with all the terms in second with duplicates removed. A specification of . is shorthand for all terms in data not already included in the model.

Value

An object of class "wa", a list with the following components:

wa.optima The WA optima for each species in the model.
fitted.values The fitted values of the response for each of the training set samples.
residuals Model residuals.
coefficients Deshrinking coefficients.
rmse The RMSE of the model.
r.squared The coefficient of determination of the observed and fitted values of the response.
avg.bias, max.bias The average and maximum bias statistics.
n.samp, n.spp The number of samples and species in the training set.
deshrink The deshrinking regression method used.
tol.dw logical; was tolerance down-weighting applied?
call The matched function call.
orig.x The training set species data.
orig.env The response data for the training set.
terms, model Model terms and model.frame components. Only returned by the formula method of wa.

Author(s)

Gavin L. Simpson

See Also

mat for an alternative transfer function method.

Examples

data(swapdiat)
data(swappH)
swapdiat <- swapdiat / 100

## fit the WA model
mod <- wa(swappH ~., data = swapdiat)
mod

## extract the fitted values
fitted(mod)

## residuals for the training set
residuals(mod)

## deshrinking coefficients
coef(mod)

## diagnostics plots
par(mfrow = c(1,2))
plot(mod)
par(mfrow = c(1,1))

[Package analogue version 0.5-1 Index]