Vinecop.simulate_conditional
- Vinecop.simulate_conditional(self, u_cond: numpy.ndarray, qrng: bool = False, num_threads: int = 1, seeds: collections.abc.Sequence[int] = []) numpy.ndarray
Simulates from the conditional distribution of a subset of variables given fixed values of the remaining variables.
The conditioning variables are the last
k = u_cond.cols()variables of the vine orderget_order()(they are drawn first by the vine and form a self-contained sub-vine). Each row ofu_condis one conditioning point; the corresponding output row is drawn from the remaining variables’ distribution conditional on that point. It is implemented as a Rosenblatt transform of the conditioning variables followed by an inverse Rosenblatt transform (seerosenblatt()/inverse_rosenblatt()).Discrete conditioning variables are supported. As for the other data-taking methods, a discrete variable requires its left-limit CDF \(F(x^-)\)in addition to \(F(x)\);
u_condtherefore carries one extra column per discrete conditioning variable (see theu_condlayout below). The conditioned variables are then drawn using the randomized transform ofrosenblatt()(see itsrandomize_discretenote).- Parameters:
- u_condndarray, shape (n, m), dtype float
An \(n \times (k + k_d)\)matrix of conditioning values, where
kis the number of conditioning variables andk_dthe number of discrete ones among them. Rowjis the conditioning point for output samplej(nisu_cond.rows()). The firstkcolumns hold the values \(F(x)\); columnicorresponds to variableget_order()[d - k + i], i.e. the columns correspond, left to right, to the lastkentries ofget_order(). The nextk_dcolumns hold the left-limits \(F(x^-)\)of the discrete conditioning variables, in the order those variables appear among the firstkcolumns. For all-continuous conditioning this is simply an \(n \times k\)matrix.kis inferred from the column count; supplying onlykcolumns when a conditioning variable is discrete may be silently reinterpreted as a differentk. To draw many samples at a single conditioning point, pass that point repeated (e.g.u0.replicate(n, 1)).- qrngbool
Set to true for quasi-random numbers (over the conditioned variables).
- num_threadsint
The number of threads to use for computations.
- seedslist of int
Seeds of the random number generator; if empty (default), the random number generator is seeded randomly.
- Returns:
- ndarray, shape (n, m), dtype float
An \(n \times d\)matrix; the remaining columns are draws from the conditional distribution. The conditioning columns reproduce
u_condexactly for continuous variables. A discrete conditioning variable is reproduced up to its atom (the column lands in \([F(x^-), F(x)]\)); with several discrete conditioning variables the later-drawn ones may land slightly outside their atom, but the draws of the remaining (conditioned) variables remain correct.