Description Usage Arguments Details Value
Generate a function which generates samples from the distribution given the inverse and collocation points.
1 2 3 4 | univariate_sampler(inverse_cdf, col_pts, xdist = "norm", gss = 1,
transform = identity, inv_transform = identity)
conditional_sampler(inverse_cdf, col_pts, gss = 1)
|
inverse_cdf |
The inverse cdf (i.e. quantile) function of the distribution to be sampled. |
col_pts |
The collocation points to use for interpolation (usually generated by scmc::optimal_points()). |
xdist |
A string indicating the distribution of the cheap variable X ni the method. Should be a <name> for which functions "p<name>" and "r<name>" exist (like "norm" or "unif") |
gss |
The sigma value of the approximating normal variable if using grid stretching. |
transform |
A function to apply to the inverse_cdf before interpolation. |
inv_transform |
A function to apply to the sample after interpolating. Should be the inverse function of the transform argument |
The univariate_sampler function is used for generating unconditional distributions using SCMC with 1-D interpolation, whereas the conditional_sampler enables generating samples from random varaibles which are conditioned on other variables. The inverse_cdf function in the conditional case must take k+1 arguments, where k is the number of conditions, and return the inverse cdf for the variable Y|X_1, ..., X_k, taking the arguments in order: (X_1, ..., X_k, p), where p is from (0,1). For example, if we sample Y|X, we have a function invcdf(x, p) = F^{-1}_{Y|X=x}(p).
For univariate_sampler, col_pts should be a vector of nodes. For the conditional_sampler, col_pts should be a list of vectors containing the node points for each dimension.
For univariate_sampler, a function which takes a single argument n, and generates a sample of size n from the wanted distribution.
For conditional_sampler, a function which takes two arguments:
n - the size of the sample to generate
conditional_samples - a list of samples of size n which are generated from the distributions on which the wanted distribution is conditioned. The list should follow the order as in inverse_cdf function
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.