rrda.predict | R Documentation |
rrda.fit
function.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}
rrda.predict(Bhat, X, nrank = NULL, lambda = NULL)
Bhat |
A list of vectors of Bhat components, obtained by the |
X |
A numeric matrix of explanatory variables. |
nrank |
A numeric vector specifying the ranks of Bhat. Default is |
lambda |
A numeric vector of ridge penalty values. Default is |
A list containing the predicted Yhat matrix, ranks, and lambda values.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.