broken_stick {zoid} | R Documentation |
Random generation of datasets using the dirichlet broken stick method
Description
Random generation of datasets using the dirichlet broken stick method
Usage
broken_stick(
n_obs = 1000,
n_groups = 10,
ess_fraction = 1,
tot_n = 100,
p = NULL
)
Arguments
n_obs |
Number of observations (rows of data matrix to simulate). Defaults to 10 |
n_groups |
Number of categories for each observation (columns of data matrix). Defaults to 10 |
ess_fraction |
The effective sample size fraction, defaults to 1 |
tot_n |
The total sample size to simulate for each observation. This is approximate and the actual simulated sample size will be slightly smaller. Defaults to 100 |
p |
The stock proportions to simulate from, as a vector. Optional, and when not included, random draws from the dirichlet are used |
Value
A 2-element list, whose 1st element X_obs
is the simulated dataset, and whose
2nd element is the underlying vector of proportions p
used to generate the data
Examples
y <- broken_stick(n_obs = 3, n_groups = 5, tot_n = 100)
# add custom proportions
y <- broken_stick(
n_obs = 3, n_groups = 5, tot_n = 100,
p = c(0.1, 0.2, 0.3, 0.2, 0.2)
)
[Package zoid version 1.3.1 Index]