## S3 method for class 'default':
pcr(x, y, ncomp, tranFun, ...)## S3 method for class 'formula':
pcr(formula, data, subset, na.action, ..., model = FALSE)
Hellinger(x, ...)
ChiSquare(x, apply = FALSE, parms)
## S3 method for class 'pcr':
performance(object, ...)
## S3 method for class 'pcr':
residuals(object, comps = NULL, ...)
## S3 method for class 'pcr':
fitted(object, comps = NULL, ...)
## S3 method for class 'pcr':
coef(object, comps = NULL, ...)
## S3 method for class 'pcr':
screeplot(x, restrict = NULL,
display = c("RMSE","avgBias","maxBias","R2"),
xlab = NULL, ylab = NULL, main = NULL, sub = NULL, ...)
## S3 method for class 'pcr':
eigenvals(x, ...)
screeplot
and eigenvals
, an object of class
"pcr"
.x
. The
function must be self-contained as no arguments are passed to the
function when it is applied. See Details for more informas.data.frame
to a data frame) containing
the variables specified on the RHS of the model formula. If not found in
NA
s. The default is set by the
na.action
setting of options
, and is na.fail
if
that is unset. The 'factory-fresh' defaultTRUE
the model frame is returned?"pcr"
."pcr"
, a list with the
following components:fitted
above.NA
if none
supplied/used.When using PCR, we might wish to apply a transformation to the species data predictor variables such that the PCA of those data preserves a dissimilarity coefficient other than the Euclidean distance. This transformation is applied to allow PCA to better describe patterns in the species data (Legendre & Gallagher 2001).
How this is handled in pcr
is to take a user-supplied function
that takes a single argument, the matrix of predictor variables. The
function should return a matrix of the same dimension as the input. If
any meta-parameters are required for subsequent use in prediction,
these should be returned as attribute "parms"
, attached to the
matrix.
Two example transformation functions are provided implementing the
Hellinger and Chi Square transformations of Legendre & Gallagher
(2001). Users can base their transformation functions on
these. ChiSquare()
illustrates how meta-parameters should be
returned as the attribute "parms"
.
wa
## Load the Imbrie & Kipp data and
## summer sea-surface temperatures
data(ImbrieKipp)
data(SumSST)
## normal interface and apply Hellinger transformation
mod <- pcr(ImbrieKipp, SumSST, tranFun = Hellinger)
mod
## formula interface, but as above
mod2 <- pcr(SumSST ~ ., data = ImbrieKipp, tranFun = Hellinger)
mod2
## Several standard methods are available
fitted(mod, comps = 1:4)
resid(mod, comps = 1:4)
coef(mod, comps = 1:4)
## Eigenvalues can be extracted
eigenvals(mod)
## screeplot method
screeplot(mod)
Run the code above in your browser using DataLab