WAR | R Documentation |
Fit Wasserstein autoregressive models to distributional time series
WAR(
Y,
qSup,
optns = list(),
FPCAoptns = list(),
aic = FALSE,
order.max = 1,
method = "yule-walker",
...
)
Y |
A |
qSup |
A vector of length |
optns |
A list of control parameters specified by |
FPCAoptns |
A list of optional control parameters for functional principal
component analysis (FPCA) of log mapped distributional predictors and responses, respectively.
See 'Details' of |
aic , order.max , method , ... |
arguments for |
Available control options are
The projection method if the predictions of log mapped distributional responses lie out of the log image space:
'log'
(default, the method as per Chen, Lin, and Müller, 2021);
'qt'
(the method as per Petersen & Müller, 2019).
Either the number of folds if using cross validation to choose the number of FPCs,
which can be any positive integer up to n
,
with suggested values: n
(leave-one-out) if n\le 30
and 10
(10-fold) if n > 30
;
Or NULL
if using other methods to choose the number of FPCs.
Lower bound of the support of distributions, only relevant if methodProj
is 'qt'
.
Default: NULL
, i.e., no finite lower bound.
Upper bound of the support of distributions, only relevant if methodProj
is 'qt'
.
Default: NULL
, i.e., no finite upper bound.
A list of class 'WAR'
with the following elements:
Yfit |
A |
qSup |
The support of quantile functions, same as the input. |
beta |
A matrix holding the fitted coefficient function, where the ( |
workGrid |
A vector holding a working grid for |
arFPCs |
An ar object returned by |
order |
The order of the fitted Wasserstein autoregressive model. |
fpcaLogY |
An FPCA object holding the FPCA output for log mapped distributions. |
Y |
The input |
outOfLogSpace |
A logical vector holding whether initial fitted log mapped distributions
lie out of the log image space ( |
optns |
A list of options actually used. |
FPCAoptns |
A list of FPCA options actually used. |
Chen, Y., Lin, Z., & Müller, H.-G. (2021). "Wasserstein regression." Journal of the American Statistical Association, in press. Petersen, A., & Müller, H.-G. (2019). "Fréchet regression for random objects with Euclidean predictors." The Annals of Statistics, 47(2), 691–719.
# X_{t} = N( mu_{t}, sigma_{t}^2 )
# mu_{t+1} = Emu + b11 * ( mu_{t} - Emu ) + b12 * ( sigma_{t} - Esigma ) + err_{mu,t+1}
# sigma_{t+1} = Esigma + b21 * ( mu_{t} - Emu ) + b22 * ( sigma_{t} - Esigma ) + err_{sigma,t+1}
bMat <- matrix( c( 1, 1, 1, -1 ) * 0.4, ncol = 2, byrow = TRUE )
# mu_{1} ~ Beta(2,2), sigma_{1} ~ Uniform(0.5,1.5) + Esigma - 1
# err ~ Uniform(-1,1) * M_err; M_err = 0.05
# | mu_{t+1} - Emu | < | mu_{t} - Emu |
# | sigma_{t+1} - Esigma | < | sigma_{t} - Esigma |
set.seed(1)
Emu <- 2
Esigma <- 2
M_err <- 0.05
mu_c <- rbeta( 1, 2, 2 ) - Emu
sigma_c <- runif( 1, 0.5, 1.5 ) - 1
dat_c <- matrix( c(mu_c,sigma_c), ncol = 1 )
n <- 100
for ( i in 2:n ) {
dat_c <- cbind( dat_c, bMat %*% dat_c[,i-1] + runif(2,-1,1) * M_err )
}
mu_c <- dat_c[1,]
mu <- mu_c + Emu
sigma_c <- dat_c[2,]
sigma <- sigma_c + Esigma
nqSup <- 1000
qSup <- seq( 0, 1, length.out = nqSup+1 )
qSup <- ( qSup[-1] + qSup[-(nqSup+1)] ) / 2
Y <- sapply( seq_len(n), function (i) {
qnorm( qSup, mean = mu[i], sd = sigma[i] )
})
res <- WAR( Y = Y, qSup = qSup )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.