Description Usage Arguments Details Value References Examples
This function takes functional observations as input and fits a nested reduced-rank regression with a user-specified rank selection method. The B-spline basis is used to conduct basis expansion.
1 2 3 4 5 6 | NRRR.func(Y, X, jx, jy, degree = 3, S.interval = NULL, T.interval = NULL,
tuning = c('CV', 'BIC', 'BICP', 'AIC', 'GCV')[1],
nfold = 10, norder = NULL, method = c('RRR', 'RRS')[1],
lambda = 0, maxiter = 300, conv = 1e-4,
dimred = c(TRUE,TRUE,TRUE), rankfix = NULL, xrankfix = NULL,
yrankfix = NULL, lang = c('R', 'Rcpp')[1])
|
Y |
a data frame of the functional responses with d columns for the values of the response components, a column indicating subject ID named as 'ID' and a column of observation times named as 'TIME'. |
X |
a data frame of the functional predictors with p columns for the values of the predictor components, a column indicating subject ID named as 'ID' and a column of observation times named as 'TIME'. Order of Subject ID should be the SAME as that of Y. |
jx |
number of basis functions to expand the predictor trajectory. |
jy |
number of basis functions to expand the response trajectory. |
degree |
degree of piecewise polynomial. Default is 3. See |
S.interval |
range of observation times of X, e.g., |
T.interval |
range of observation times of Y, e.g., |
tuning |
methods to select ranks. If |
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. |
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 |
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. |
dimred |
a vector of logical values to decide whether to use the specified tuning method
do rank selection on certain dimensions. TRUE means the rank is selected
by the specified tuning method.
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. |
This function applies a basis expansion and truncation method to transform
the functional problem into a classical finite-dimensional regression problem,
and then fits a nested reduced-rank regression.
The functional observations are commonly collected in a discrete mannar, and before using this
function, the functional response observations and functional predictor observations
should be saved as a data frame. Data standardization procedures, e.g., centering or
scaling, should be conducted before using this function. B-spline basis is
used to conduct basis expansion. If the functional data are already processed into an integrated form,
functions like NRRR.est
, NRRR.ic
or NRRR.cv
can
be used to fit a NRRR model.
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. Only available when 'CV' is selected. |
ry_path |
a matrix displays the path of selecting ry with cross validation. Only available when 'CV' is selected. |
r_path |
a matrix displays the path of selecting r with cross validation. Only available when 'CV' is selected. |
rank |
the estimated r. |
rx |
the estimated rx. |
ry |
the estimated ry. |
sseq |
sequence of the time points of observing the predictor trajectory. |
phi |
the basis functions to expand the predictor trajectory. |
tseq |
sequence of the time points of observing the response trajectory. |
psi |
the basis functions to expand the response trajectory. |
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 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | n <- 100
ns <- 80
nt <- 80
p <- 10
d <- 10
jx <- 8
jy <- 8
library(NRRR)
set.seed(3)
# generate functional data
simDat <- NRRR.sim(n = 100, ns = 80, nt = 80, r = 3, rx = 3, ry = 3,
jx = 8, jy = 8, p = 10, d = 10, s2n = 1, rho_X = 0.5,
rho_E = 0, Sigma = "CorrAR")
# dimension: c(n, d, nt)
dim(simDat$Y)
# dimension: c(n, p, ns)
dim(simDat$X)
# process the functional data into a data frame with columns:
# predictor/response components, subject ID, and observation time
Y <- t(simDat$Y[1,,])
for (i in 2:n){
Y <- rbind(Y, t(simDat$Y[i,,]))
}
Y <- data.frame(Y)
Y$TIME <- rep(simDat$tseq, n)
Y$ID <- rep(1:n, each = nt) # Y: nt*n rows, d+2 columns
head(Y)
X <- t(simDat$X[1,,])
for (i in 2:n){
X <- rbind(X, t(simDat$X[i,,]))
}
X <- data.frame(X)
X$TIME <- rep(simDat$sseq, n)
X$ID <- rep(1:n, each = ns) # X: ns*n rows, p+2 columns
head(X)
fit_func <- NRRR.func(Y, X, jx, jy, degree = 3, S.interval = NULL, T.interval = NULL,
tuning = c('CV', 'BIC', 'BICP', 'AIC', 'GCV')[2],
nfold = 10, norder = NULL, method = c('RRR', 'RRS')[1],
lambda = 0, maxiter = 300, conv = 1e-4,
dimred = c(TRUE,TRUE,TRUE), rankfix = NULL, xrankfix = NULL,
yrankfix = NULL, lang = c('R', 'Rcpp')[1])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.