Vinecop.rosenblatt
- Vinecop.rosenblatt(self: pyvinecopulib.Vinecop, u: numpy.ndarray[numpy.float64[m, n]], num_threads: int = 1, randomize_discrete: bool = True, seeds: list[int] = []) numpy.ndarray[numpy.float64[m, n]]
Evaluates the Rosenblatt transform for a vine copula model.
The Rosenblatt transform converts data from this model into independent uniform variates.
The Rosenblatt transform (Rosenblatt, 1952) \(U = T(V)\) of a random vector \(V = (V_1,\ldots,V_d) ~ F\) is defined as
\[U_1= F(V_1), U_{2} = F(V_{2}|V_1), \ldots, U_d =F(V_d|V_1,\ldots,V_{d-1}),\]where \(F(v_k|v_1,\ldots,v_{k-1})\) is the conditional distribution of \(V_k\) given \(V_1 \ldots, V_{k-1}, k = 2,\ldots,d\). The vector \(U = (U_1, \dots, U_d)\) then contains independent standard uniform variables. The inverse operation
\[V_1 = F^{-1}(U_1), V_{2} = F^{-1}(U_2|U_1), \ldots, V_d =F^{-1}(U_d|U_1,\ldots,U_{d-1})\]can be used to simulate from a distribution. For any copula \(F\), if \(U\) is a vector of independent random variables, \(V = T^{-1}(U)\) has distribution \(F\).
The formulas above assume a vine copula model with order \(d, \dots, 1\). More generally,
Vinecop.rosenblatt()
returns the variables\[U_{M[d - j, j]}= F(V_{M[d - j, j]} | V_{M[d - j - 1, j - 1]}, \dots, V_{M[0, 0]}),\]where \(M\) is the structure matrix. Similarly,
Vinecop.inverse_rosenblatt()
computes\[V_{M[d - j, j]}= F^{-1}(U_{M[d - j, j]} | U_{M[d - j - 1, j - 1]}, \dots, U_{M[0, 0]}).\]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
\[U_{M[d - j, j]}= W_{d - j} F(V_{M[d - j, j]} | V_{M[d - j - 1, j - 1]}, \dots, V_{M[0,\]0]}) + (1 - W_{d - j}) F^-(V_{M[d - j, j]} | V_{M[d - j - 1, j - 1]}, dots, V_{M[0, 0]}),
where \(F^-\) is the left limit of the conditional cdf and \(W_1, \dots, W_d\) are are independent standard uniform random variables. This is used by default. If you are interested in the conditional probabilities
\[F(V_{M[d - j, j]} | V_{M[d - j - 1, j - 1]}, \dots, V_{M[0, 0]}),\]set
randomize_discrete = FALSE
.- Parameters:
u – An \(n \times d\) matrix of evaluation points.
num_threads – The number of threads to use for computations; if greater than 1, the function will be applied concurrently to
num_threads
batches ofu
.randomize_discrete – Whether to randomize the transform for discrete variables; see Details.
seeds – Seeds to scramble the quasi-random numbers; if empty (default), the random number quasi-generator is seeded randomly. Only relevant if there are discrete variables and
randomize_discrete = TRUE
.
- Returns:
An \(n \times d\) matrix of independent uniform variates.