cvband_pred | R Documentation |
Examines the prediction performance of the separable-plus-banded model for
different (discrete) bandwidths d=mind
,...,maxd
via a
cross-validated scheme: for every surface in the current hold-out sample,
a part of the surface (a fixed number of last few rows and columns
give by perc
) is predicted based on the remainder of the given surface,
and relative prediction error is calculated.
cvband_pred(X, Folds = 10, maxd = 20, mind = 1, perc = c(1/4, 1/4))
X |
data, array of size N x K1 x K2 |
Folds |
number of folds |
maxd |
maximum bandwidth value to check |
mind |
minimum bandwidth value to check |
perc |
vector of 2 values in (0,1) giving the ratio of rows and columns to be predicted |
vector of cross-validated prediction errors for
d=mind
,...,maxd
N <- 4 K1 <- 4 K2 <- 4 set.seed(517) X <- array(0,c(N,K1,K2)) A <- matrix(rnorm(K1^2),K1) B <- matrix(rnorm(K2^2),K2) A <- A %*% t(A) B <- B %*% t(B) A <- mat_root(A) B <- mat_root(B) for(n in 1:N){ X[n,,] <- A %*% X[n,,] %*% B + matrix(rnorm(K1*K2),K1) } ( cvscores <- cvband_pred(X,2,2,0) ) min(localMaxima(-cvscores))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.