cca.predict: Make predictions using canonical correlation analysis (CCA)

Description Usage Arguments Details Value References Examples

View source: R/cca.predict.R

Description

Canonical correlation analysis (CCA) is sometimes referred to as a double-barreled principal component analysis. Loosely, it fits a linear regression model to the scores of principal component decompositions for of the predictors X and responses Y. Oftentimes, only the largest k principal components are used to make predictions.

Usage

1
cca.predict(X, Y, X.new, k.x, k.y)

Arguments

X

An (nvars x nobs) data frame or matrix in which each column contains all observations of measured (predictor) variables for a given timepoint or sample. For example, if X represents a spatial variable that was recorded at several timepoints, then each row of X should contain the variable's measurement for all timepoints at a single location.

Y

An (nvars x nobs) data frame or matrix in which each column contains all observations of measured (response) variables for a given timepoint or sample.

X.new

An (nvars x nobs.new) data frame or matrix of values to use to predict Y.new using CCA.

k.x

An integer less than (nobs) indicating how many eigenvectors of (X) to use in the CCA.

k.y

An integer less than (nobs) indicating how many eigenvectors of (Y) to use in the CCA.

Details

CCA has been used to predict a teleconnected response (like precipitation) using the remote field generating the teleconnection (like ocean temperatures). In this application, principal components are often referred to as empirical orthogonal functions (EOFs).

Value

Y.new Predicted values for Y.new

References

Cook, E.R., Briffa, K.R., and Jones, P.D., 1994, Spatial regression methods in dendroclimatology: A review and comparison of two techniques: International Journal of Climatology, v. 14, p. 379-402.

Glahn, H.R., 1968, Canonical Correlation and Its Relationship to Discriminant Analysis and Multiple Regression: Journal of the Atmospheric Sciences, v. 25, p. 23-31.

Examples

1
2
3
4
5
6
7
8
9
data("coprecip")
attach(coprecip)

# compute CCA predictions of Y (CO precipitation) given Z (Pacific ocean SSTs)
# using 2 principal components (aka. EOFs)
preds = cca.predict(X = Z, Y = Y, X.new = Z, k.x = 2, k.y = 2)

# compute R^2
1 - var(as.numeric(preds-Y)) / var(as.numeric(Y))

telefit documentation built on Feb. 4, 2020, 9:08 a.m.

Related to cca.predict in telefit...