R/broken_stick.R
broken_stick.Rd
Random generation of datasets using the dirichlet broken stick method
broken_stick(
n_obs = 1000,
n_groups = 10,
ess_fraction = 1,
tot_n = 100,
p = NULL
)
Number of observations (rows of data matrix to simulate). Defaults to 10
Number of categories for each observation (columns of data matrix). Defaults to 10
The effective sample size fraction, defaults to 1
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
The stock proportions to simulate from, as a vector. Optional, and when not included, random draws from the dirichlet are used
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
# \donttest{
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)
)
# }