Description Usage Arguments Details Value References Examples
View source: R/NestRRR.select.r
This function selects the optimal ranks (r, rx, ry)
using a user-specified
information criterion. The degrees of freedom is estimated by the number of
free parameters in the model. The blockwise coordinate descent algorithm is used to fit
the model with any combinations of (r, rx, ry)
.
1 2 3 4 5 6 7 |
Y |
response matrix of dimension n-by-jy*d. |
X |
design matrix of dimension n-by-jx*p. |
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 |
ic |
the user-specified information criterion. Four options are available, i.e., BIC, BICP, AIC, GCV. |
dimred |
a vector of logical values to decide whether to use the selected information criterion
do rank selection on certain dimensions. TRUE means the rank is selected
by the selected information criterion. 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. |
Denote \hat C(r, rx, ry) as the estimator of the coefficient matrix with the rank values fixed at some (r, rx, ry) and write the sum of squared errors as SSE(r, rx, ry)=||Y - X\hat C(r, rx, ry)||_F^2. We define
BIC(r, rx, ry) = n*d*jy*log(SSE(r, rx, ry)/(n*d*jy)) + log(n*d*jy)*df(r, rx, ry),
where df(r, rx, ry) is the effective degrees of freedom and is estimated by the number of free parameters
\hat df(r, rx, ry) = rx*(rank(X)/jx - rx) + ry*(d - ry) + (jy*ry + jx*rx - r)*r.
We can define other information criteria in a similar way. With the defined BIC, a three-dimensional grid search procedure of the rank values is performed, and the best model is chosen as the one with the smallest BIC value. 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 NRRR 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. |
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 21 22 | library(NRRR)
set.seed(3)
# Simulation setting 2 in NRRR paper
simDat <- NRRR.sim(n = 100, ns = 100, nt = 100, r = 3, rx = 3, ry = 3,
jx = 8, jy = 8, p = 20, d = 20, s2n = 1, rho_X = 0.5,
rho_E = 0, Sigma = "CorrAR")
# using R function
fit_R <- with(simDat, NRRR.ic(Yest, Xest, Ag0 = NULL, Bg0 = NULL,
jx = 8, jy = 8, p = 20, d = 20, n = 100,
maxiter = 300, conv = 1e-4, method = c("RRR", "RRS")[1],
lambda = 0, ic = c("BIC", "BICP", "AIC", "GCV")[1],
dimred = c(TRUE, TRUE, TRUE), rankfix = NULL,
xrankfix = NULL, yrankfix = NULL,
lang=c('R','Rcpp')[1]))
# using Rcpp function
fit_Rcpp <- with(simDat, NRRR.ic(Yest, Xest, Ag0 = NULL, Bg0 = NULL,
jx = 8, jy = 8, p = 20, d = 20, n = 100,
maxiter = 300, conv = 1e-4, method = c("RRR", "RRS")[1],
lambda = 0, ic = c("BIC", "BICP", "AIC", "GCV")[1],
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.