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
|
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
|
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 |
predict |
a list of estimated correlation matrices at |
residuals |
Frobenius distance between the true and fitted correlation matrices. |
xOut |
the output predictor level used. |
optns |
the control options used. |
References
-
Petersen, A. and Müller, H.-G. (2019). Fréchet regression for random objects with Euclidean predictors. The Annals of Statistics, 47(2), 691–719.
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
)
)