rrda.predict {rrda}R Documentation

Calculate the predicted matrix Yhat using the coefficient Bhat obtained from the rrda.fit function.

Description

This function calculates the predicted response matrix (Yhat) using Bhat (the coefficient of Ridge Redundancy Analysis) obtained from the rrda.fit function. The user can specify the ranks and lambda values to be used for the prediction. If not provided, the ranks and lambda values are set based on the Bhat components. The function returns the predicted Yhat matrix, as well as the ranks and lambda values used.

The predicted response matrix is calculated as:

\hat{Y}_r = X \left( \sum_{i=1}^{r} (F_{.i} G_{.i}^{\prime}) \right) = \sum_{i=1}^{r} (X F_{.i} G_{.i}^{\prime}) = \sum_{i=1}^{r} (\tilde{X}_{.i} G_{.i}^{\prime})

Here, \tilde{X} = X F, and r is the rank of \hat{B}(\lambda, r). The regularized-rank-restricted estimation of B is obtained from the rrda.fit function:

\hat{B}(\lambda, r) = FG^{\prime}

Usage

rrda.predict(Bhat, X, nrank = NULL, lambda = NULL)

Arguments

Bhat

A list of vectors of Bhat components, obtained by the rrda.fit function.

X

A numeric matrix of explanatory variables.

nrank

A numeric vector specifying the ranks of Bhat. Default is NULL, which sets it to the ranks defined in the Bhat components.

lambda

A numeric vector of ridge penalty values. Default is NULL, which sets it to the lambda values defined in the Bhat components.

Value

A list containing the predicted Yhat matrix, ranks, and lambda values.

Examples

set.seed(10)
simdata<-rdasim1(n = 100,p = 200,q = 200,k = 5)
X <- simdata$X
Y <- simdata$Y
Bhat <- rrda.fit(Y = Y, X = X, nrank = c(1:10))
Yhat_mat <- rrda.predict(Bhat = Bhat, X = X, nrank = 10)

[Package rrda version 0.1.1 Index]