50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


rvinecopulib (version 0.7.1.1.2)

rosenblatt: (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, randomize_discrete = TRUE)

inverse_rosenblatt(u, model, cores = 1)

Arguments

x

matrix of evaluation points; must be in (0,1)d for copula models.

model

a model object; classes currently supported are bicop_dist(), vinecop_dist(), and vine_dist().

cores

if >1, computation is parallelized over cores batches (rows of u).

randomize_discrete

Whether to randomize the transform for discrete variables; see Details.

u

matrix of evaluation points; must be in (0,1)d.

Details

The Rosenblatt transform (Rosenblatt, 1952) U=T(V) of a random vector V=(V1,,Vd) F is defined as U1=F(V1),U2=F(V2|V1),,Ud=F(Vd|V1,,Vd1), where F(vk|v1,,vk1) is the conditional distribution of Vk given V1,Vk1,k=2,,d. The vector U=(U1,,Ud) then contains independent standard uniform variables. The inverse operation V1=F1(U1),V2=F1(U2|U1),,Vd=F1(Ud|U1,,Ud1), can be used to simulate from a distribution. For any copula F, if U is a vector of independent random variables, V=T1(U) has distribution F.

The formulas above assume a vine copula model with order d,,1. More generally, rosenblatt() returns the variables UM[d+1j,j]=F(VM[dj+1,j]|VM[dj,j],,VM[1,j]), where M is the structure matrix. Similarly, inverse_rosenblatt() returns VM[d+1j,j]=F1(UM[dj+1,j]|UM[dj,j],,UM[1,j]).

If some variables have atoms, Brockwell (10.1016/j.spl.2007.02.008) proposed a simple randomization scheme to ensure that output is still independent uniform if the model is correct. The transformation reads UM[dj,j]=WdjF(VM[dj,j]|VM[dj1,j1],,VM[0,0])+(1Wdj)F(VM[dj,j]|VM[dj1,j1],,VM[0,0]), where F is the left limit of the conditional cdf and W1,,Wd are are independent standard uniform random variables. This is used by default. If you are interested in the conditional probabilities F(VM[dj,j]|VM[dj1,j1],,VM[0,0]), set randomize_discrete = FALSE.

Examples

Run this code
# 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)

Run the code above in your browser using DataLab