View source: R/regime-sampler.R
| regime_sampler | R Documentation |
Combines per-target regime probability vectors into row-level sampling probabilities and samples candidate future-trajectory rows accordingly.
regime_sampler(
trafo_df,
cluster_df,
prob_vectors,
weights = NULL,
size = 1000L,
return_type = c("stack", "index"),
seed = NULL,
eps = 1e-12,
...
)
trafo_df |
Data frame of candidate transformed observations to sample. |
cluster_df |
Data frame of regime labels for each candidate row. Must have the same number of rows as |
prob_vectors |
Named list of probability vectors or one-row matrices/data frames, one per target regime column. Names should correspond to columns of |
weights |
Optional numeric weights for target regime columns. |
size |
Number of rows or indices to sample with replacement. |
return_type |
Return sampled rows as |
seed |
Optional random seed. |
eps |
Small positive probability floor. |
... |
Additional arguments. The legacy argument name |
If return_type = "stack", a data frame sampled from trafo_df.
If return_type = "index", an integer vector of sampled row indices.
trafo <- data.frame(x = 1:4)
clusters <- data.frame(r = c("low", "low", "high", "high"))
probs <- list(r = c(low = 0.2, high = 0.8))
regime_sampler(trafo, clusters, probs, size = 5, seed = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.