scd: Separable Component Decomposition of the Empirical Covariance

View source: R/scd.R

scdR Documentation

Separable Component Decomposition of the Empirical Covariance

Description

Performs the power iteration method to find the separable expansion for C = cov(X), i.e. to find the decomposition C = sigma1 A1 x B1 + sigma2 A2 x B2 + ... + sigmaR AR x BR. When the degree-of-separability R is not provided, cross-validation (CV) is performed.

Usage

scd(
  X,
  R = NULL,
  B = NULL,
  mu = NULL,
  predict = FALSE,
  maxiter = 10,
  maxR = NULL,
  Folds = NULL,
  perc = c(1/4, 1/4)
)

Arguments

X

data array of size N x K1 x K2

R

integer, the degree-of-separability

B

array of size R x K2 x K2 specifying the initial values for B1,...,BR. Defaults to partially traced initializations. If R not provided by the user, B should be array of size K2 x K2, and this single starting point is used for every degree-of-separability.

mu

matrix of size K1 x K2, the mean, defaults to the empirical mean

predict

flag whether prediction-based cross-validation should be used, the default is fit-based cross-validation

maxiter

integer, maximum number of power iterations, defaults to 10

maxR

integer, maximum value of the degree-of-separability R to be probed via CV (used only when R not provided directly)

Folds

number of folds for cross-validation, defaults to 10

perc

vector of 2, if predict=T, what proportions (in time and space) of every observation should be predicted. When perc>=1, specific number of grid lines is predicted, e.g. perc=1 corresponds to one-step-ahead prediction (in both space and time)

Value

list of the following objects:list of 3:

  • A - array of size R x K1 x K1, the first R temporal kernels;

  • B - array of size R x K2 x K2, the first R spatial kernels;

  • sigma - vector of length R, the separable component scores

if cross-validation was conducted, the list contains also:

  • cv - the CV objective values, a smaller value is better

  • R - the chosen bandwidth

Examples

N <- 10
K1 <- K2 <- 10
x <- 1:K1/(K1+1)
e0 <- rep(1,K1)
e1 <- sin(2*pi*x)
e2 <- cos(2*pi*x)
X <- array(0,c(N,K1,K2))
set.seed(123)
for(n in 1:N){
  X[n,,] <- 2*rnorm(1)*outer(e0,e0) + rnorm(1)*outer(e1,e1) +
    rnorm(1)*outer(e2,e2)
}
SCD <- scd(X)
SCD$R # the degree-of-separability chosen by fit-based CV
SCD <- scd(X,predict=TRUE)
SCD$R # the degree-of-separability leading to best predictions
SCD <- scd(X,predict=TRUE,perc=1)
SCD$R # the degree-of-separability leading to best one-step-ahead (both in
      # space and time) predictions

TMasak/surfcov documentation built on April 25, 2022, 12:15 a.m.