View source: R/sample_size_effect.R
| ppi_samplesize_effect | R Documentation |
For a given index function, simulates how the index behaves across a range of sample sizes. By default, standard bivariate Gaussian noise is used, but the user may instead supply a 2-column dataset to sample from.
ppi_samplesize_effect(
index_fun,
sample_sizes = 100,
n_sim = 100,
data = NULL,
csv_file = NULL,
index_args = list(),
workers = 1
)
index_fun |
A function returning a numeric scalar index. It may accept
either a 2-column matrix/data frame, or two numeric vectors ( |
sample_sizes |
Numeric vector (e.g., 100, c(50,100,200), seq(30,200,5)). Default is 100. |
n_sim |
Integer. Number of simulations per sample size. |
data |
Optional 2-column data frame, tibble, or matrix to sample from.
If |
csv_file |
Optional file path to save results as CSV. |
index_args |
A named list of additional arguments passed to |
workers |
Integer. Number of parallel workers to use. Default is 1. |
A tibble with:
sample_size: sample size used for each simulation block
percentile95: 95th percentile of the index values over simulations
## Not run:
ppi_samplesize_effect(
cassowaryr::sc_stringy,
sample_sizes = c(100, 300),
n_sim = 3,
index_args = list(binner = "hex"),
workers = 2
)
ppi_samplesize_effect(
cassowaryr::sc_skinny,
sample_sizes = c(100, 300),
n_sim = 3,
data = data_gen("polynomial", degree = 2),
workers = 2
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.