NRRR.cv: Select ranks with cross validation

Description Usage Arguments Details Value References Examples

View source: R/NestRRR.cv.select.r

Description

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).

Usage

1
2
3
4
5
NRRR.cv(Y, X, nfold = 10, norder = NULL, Ag0 = NULL, Bg0 = NULL,
        jx, jy, p, d, n, 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])

Arguments

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 Ag0 = NULL then generate it by NRRR.ini. Default is NULL. If lang = 'Rcpp', then Ag0 is automatically generated by NRRR.ini.

Bg0

an initial estimator of matrix V, if Bg0 = NULL then generate it by NRRR.ini. Default is NULL. If lang = 'Rcpp', then Bg0 is automatically generated by NRRR.ini.

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 method = 'RRS'. Default is 0.

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 dimred[1] = FALSE, r is provided by rankfix or min(jy*d, rank(X)); If dimred[2] = FALSE, rx equals to xrankfix or p; If dimred[3] = FALSE, ry equals to yrankfix or d. Default is c(TRUE, TRUE, TRUE).

rankfix

a user-provided value of r when dimred[1] = FALSE. Default is NULL which leads to r = min(jy*d, rank(X)).

xrankfix

a user-provided value of rx when dimred[2] = FALSE. Default is NULL which leads to rx = p.

yrankfix

a user-provided value of ry when dimred[3] = FALSE. Default is NULL which leads to ry = d.

lang

'R' (default): the R version function is used; 'Rcpp': the Rcpp version function is used.

Details

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.

Value

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.

References

Liu, X., Ma, S., & Chen, K. (2020). Multivariate Functional Regression via Nested Reduced-Rank Regularization. arXiv: Methodology.

Examples

 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]))

xliu-stat/NRRR documentation built on Jan. 9, 2021, 3:23 p.m.