Description Usage Arguments Details Value References Examples
View source: R/NestRRR.cv.select.r
This function selects the optimal ranks (r, rx, ry)
using a cross
validation procedure. The blockwise coordinate descent algorithm is used to fit
the model with any combinations of (r, rx, ry)
.
1 2 3 4 5 |
Y |
response matrix of dimension n-by-jy*d. |
X |
design matrix of dimension n-by-jx*p. |
nfold |
the number of folds used in cross validation. Default is 10. |
norder |
a vector of length n that assigns samples to multiple folds for cross validation. |
Ag0 |
an initial estimator of matrix U. If |
Bg0 |
an initial estimator of matrix V, if |
jx |
number of basis functions to expand the functional predictor. |
jy |
number of basis functions to expand the functional response. |
p |
number of predictors. |
d |
number of responses. |
n |
sample size. |
maxiter |
the maximum iteration number of the blockwise coordinate descent algorithm. Default is 300. |
conv |
the tolerance level used to control the convergence of the blockwise coordinate descent algorithm. Default is 1e-4. |
method |
'RRR' (default): no additional ridge penalty; 'RRS': add an additional ridge penalty. |
lambda |
the tuning parameter to control the amount of ridge
penalization. It is only used when |
dimred |
a vector of logical values to decide whether to use cross validation
do rank selection on certain dimensions. TRUE means the rank is selected
by cross validation.
If |
rankfix |
a user-provided value of r when |
xrankfix |
a user-provided value of rx when |
yrankfix |
a user-provided value of ry when |
lang |
'R' (default): the R version function is used; 'Rcpp': the Rcpp version function is used. |
A three-dimensional grid search procedure of the rank values is performed, and the best model is chosen as the one with the smallest prediction error. Instead of a nested rank selection method, we apply a one-at-a-time selection approach. We first set rx = p, ry = d, and select the best local rank \hat r among the models with 1 ≤ r ≤ min(rank(X), jy*d). We then fix the local rank at \hat r and repeat a similar procedure to determine \hat rx and \hat ry, one at a time. Finally, with fixed \hat rx and \hat ry, we refine the estimation of r.
The function returns a list:
Ag |
the estimated U. |
Bg |
the estimated V. |
Al |
the estimated A. |
Bl |
the estimated B. |
C |
the estimated coefficient matrix C. |
df |
the estimated degrees of freedom of the selected model. |
sse |
the sum of squared errors of the selected model. |
ic |
a vector containing values of BIC, BICP, AIC, GCV of the selected model. |
rx_path |
a matrix displays the path of selecting rx with cross validation. |
ry_path |
a matrix displays the path of selecting ry with cross validation. |
r_path |
a matrix displays the path of selecting r with cross validation. |
rank |
the estimated r. |
rx |
the estimated rx. |
ry |
the estimated ry. |
Liu, X., Ma, S., & Chen, K. (2020). Multivariate Functional Regression via Nested Reduced-Rank Regularization. arXiv: Methodology.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | library(NRRR)
set.seed(1)
# Simulation setting 1 in NRRR paper
simDat <- NRRR.sim(n = 100, ns = 60, nt = 60, r = 5, rx = 3, ry = 3,
jx = 8, jy = 8, p = 10, d = 10, s2n = 1,
rho_X = 0.5, rho_E = 0, Sigma = "CorrAR")
# using R function
fit_R <- with(simDat, NRRR.cv(Yest, Xest, nfold = 10, norder = NULL,
Ag0 = NULL, Bg0 = NULL, jx = 8, jy = 8, p = 10, d = 10,
n = 100, maxiter = 300, conv = 1e-4,
method = c("RRR", "RRS")[1], lambda = 0,
dimred = c(TRUE, TRUE, TRUE), rankfix = NULL,
xrankfix = NULL, yrankfix = NULL, lang=c('R','Rcpp')[1]))
# using Rcpp function
fit_Rcpp <- with(simDat, NRRR.cv(Yest, Xest, nfold = 10, norder = NULL,
Ag0 = NULL, Bg0 = NULL, jx = 8, jy = 8, p = 10,
d = 10, n = 100, maxiter = 300, conv = 1e-4,
method = c("RRR", "RRS")[1], lambda = 0,
dimred = c(TRUE, TRUE, TRUE), rankfix = NULL,
xrankfix = NULL, yrankfix = NULL, lang=c('R','Rcpp')[2]))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.