rosenblatt {rvinecopulib} | R Documentation |
(Inverse) Rosenblatt transform
Description
The Rosenblatt transform takes data generated from a model and turns it into independent uniform variates, The inverse Rosenblatt transform computes conditional quantiles and can be used simulate from a stochastic model, see Details.
Usage
rosenblatt(x, model, cores = 1)
inverse_rosenblatt(u, model, cores = 1)
Arguments
x |
matrix of evaluation points; must be in |
model |
a model object; classes currently supported are
|
cores |
if |
u |
matrix of evaluation points; must be in |
Details
The Rosenblatt transform (Rosenblatt, 1952) of a random vector
is defined as
where is the conditional distribution of
given
. The vector
then contains independent standard uniform
variables. The inverse operation
can be used to simulate from a distribution. For any copula , if
is a vector of independent random variables,
has
distribution
.
The formulas above assume a vine copula model with order .
More generally,
rosenblatt()
returns the variables
where is the structure matrix. Similarly,
inverse_rosenblatt()
returns
Examples
# simulate data with some dependence
x <- replicate(3, rnorm(200))
x[, 2:3] <- x[, 2:3] + x[, 1]
pairs(x)
# estimate a vine distribution model
fit <- vine(x, copula_controls = list(family_set = "par"))
# transform into independent uniforms
u <- rosenblatt(x, fit)
pairs(u)
# inversion
pairs(inverse_rosenblatt(u, fit))
# works similarly for vinecop models
vc <- fit$copula
rosenblatt(pseudo_obs(x), vc)