VarObj {frechet} | R Documentation |
Fréchet Variance Trajectory for densities
Description
Modeling time varying density objects with respect to $L^2$-Wasserstein distance by Fréchet variance trajectory
Usage
VarObj(tgrid, yin = NULL, hin = NULL, din = NULL, qin = NULL, optns = list())
Arguments
tgrid |
Time grid vector for the time varying object data. |
yin |
An array or list of lists holding the samples of observations. If |
hin |
A list of lists holding the histogram for each subject. |
din |
A three dimension array of size |
qin |
A three dimension array of size |
optns |
a list of options control parameters specified by |
Details
Available control options are qSup
, nqSup
, dSup
and other options in FPCA of fdapace.
Value
A list of the following:
tgridout |
Time grid vector for the output time varying object data. |
K |
Numbers of principal components. |
nu |
A vector of dimension |
lambda |
A vector of dimension |
phi |
A |
xiEst |
A |
cumFVE |
A vector of dimension |
FPCAObj |
FPCA Object of Fréchet variance function. |
tgridin |
Input |
qSup |
A vector of dimension |
qout |
A three dimension array of dimension |
qmean |
A |
VarTraj |
A |
References
Dubey, P., & Müller, H. G. (2021). Modeling Time-Varying Random Objects and Dynamic Networks. Journal of the American Statistical Association, 1-33.
Examples
set.seed(1)
#use yin
tgrid = seq(1, 50, length.out = 50)
dSup = seq(-10, 60, length.out = 100)
yin = array(dim=c(30, 50, 100))
for(i in 1:30){
yin[i,,] = t(sapply(tgrid, function(t){
rnorm(100, mean = rnorm(1, mean = 1, sd = 1/t))
}))
}
result1 = VarObj(tgrid, yin = yin)
plot(result1$phi[,1])
plot(result1$phi[,2])
yin2 = replicate(30, vector("list", 50), simplify = FALSE)
for(i in 1:30){
for(j in 1:50){
yin2[[i]][[j]] = yin[i,j,]
}}
result1 = VarObj(tgrid, yin = yin2)
# use hin
tgrid = seq(1, 50, length.out = 50)
dSup = seq(-10, 60, length.out = 100)
hin = replicate(30, vector("list", 50), simplify = FALSE)
for(i in 1:30){
for (j in 1:50){
hin[[i]][[j]] = hist(yin[i,j,])
}
}
result2 = VarObj(tgrid, hin = hin)
# use din
tgrid = seq(1, 50, length.out = 50)
dSup = seq(-10, 60, length.out = 100)
din = array(dim=c(30, 50, 100))
for(i in 1:30){
din[i,,] = t(sapply(tgrid, function(t){
dnorm(dSup, mean = rnorm(1, mean = t, sd = 1/t))
}))
}
result3 = VarObj(tgrid, din = din, optns=list(dSup = dSup))
# use qin
tgrid = seq(1, 50, length.out = 50)
qSup = seq(0.00001,1-0.00001,length.out = 100)
qin = array(dim=c(30, 50, 100))
for(i in 1:30){
qin[i,,] = t(sapply(tgrid, function(t){
qnorm(qSup, mean = rnorm(1, mean = t, sd = 1/t))
}))
}
result4 = VarObj(tgrid, qin = qin, optns=list(qSup = round(qSup, 4)))