LocCorReg {frechet}R Documentation

Local Fréchet regression for correlation matrices

Description

Local Fréchet regression for correlation matrices with Euclidean predictors.

Usage

LocCorReg(x, M, xOut = NULL, optns = list())

Arguments

x

an n by p matrix or data frame of predictors.

M

a q by q by n array (resp. a list of q by q matrices) where M[, , i] (resp. M[[i]]) contains the i-th correlation matrix of dimension q by q.

xOut

an m by p matrix or data frame of output predictor levels. It can be a vector of length p if m = 1.

optns

A list of options control parameters specified by list(name=value). See ‘Details’.

Details

Available control options are

metric

choice of metric. 'frobenius' and 'power' are supported, which corresponds to Frobenius metric and Euclidean power metric, respectively. Default is Frobenius metric.

alpha

the power for Euclidean power metric. Default is 1 which corresponds to Frobenius metric.

kernel

Name of the kernel function to be chosen from 'gauss', 'rect', 'epan', 'gausvar' and 'quar'. Default is 'gauss'.

bw

bandwidth for local Fréchet regression, if not entered it would be chosen from cross validation.

digits

the integer indicating the number of decimal places (round) to be kept in the output. Default is NULL, which means no round operation.

Value

A corReg object — a list containing the following fields:

fit

a list of estimated correlation matrices at x.

predict

a list of estimated correlation matrices at xOut. Included if xOut is not NULL.

residuals

Frobenius distance between the true and fitted correlation matrices.

xOut

the output predictor level used.

optns

the control options used.

References

Examples

# Generate simulation data

n <- 100
q <- 10
d <- q * (q - 1) / 2
xOut <- seq(0.1, 0.9, length.out = 9)
x <- runif(n, min = 0, max = 1)
y <- list()
for (i in 1:n) {
  yVec <- rbeta(d, shape1 = sin(pi * x[i]), shape2 = 1 - sin(pi * x[i]))
  y[[i]] <- matrix(0, nrow = q, ncol = q)
  y[[i]][lower.tri(y[[i]])] <- yVec
  y[[i]] <- y[[i]] + t(y[[i]])
  diag(y[[i]]) <- 1
}
# Frobenius metric
fit1 <- LocCorReg(x, y, xOut,
  optns = list(metric = "frobenius", digits = 2)
)
# Euclidean power metric
fit2 <- LocCorReg(x, y, xOut,
  optns = list(
    metric = "power", alpha = .5,
    kernel = "epan", bw = 0.08
  )
)


[Package frechet version 0.3.0 Index]