find_critical_pos: Find the critical point of stability

Description Usage Arguments Value Examples

View source: R/fastpos.R

Description

Run simulations for one or several population correlations and return the critical points of stability (POS). The critical point of stability is the sample size at which a certain percentage of studies will fall into an a priori specified interval and stay in this interval if the sample size is increased further.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
find_critical_pos(
  rhos,
  precision = 0.1,
  precision_rel = FALSE,
  sample_size_min = 20,
  sample_size_max = 1000,
  replace = TRUE,
  n_studies = 10000,
  confidence_levels = c(0.8, 0.9, 0.95),
  pop_size = 1e+06,
  n_cores = 1
)

Arguments

rhos

Vector of population correlations (can also be a single correlation).

precision

Precision around the correlation which is acceptable (defaults to 0.1). The precision will determine the corridor of stability which is just rho+-precision.

precision_rel

Whether the precision is absolute (rho+-precision or relative rho+-rho*precision), boolean (defaults to FALSE).

sample_size_min

Minimum sample size for each study (defaults to 20).

sample_size_max

Maximum sample size for each study (defaults to 1e3).

replace

Whether drawing samples is with replacement or not.

n_studies

Number of studies to run for each rho (defaults to 10e3).

confidence_levels

Confidence levels for point of stability. This corresponds to the quantile of the distribution of all found critical sample sizes (defaults to c(.8, .9, .95)).

pop_size

Population size (defaults to 1e6).

n_cores

Number of cores to use for simulation.

Value

A data frame containing all the above information, as well as the points of stability.

Examples

1
2
find_critical_pos(rhos = 0.5)
find_critical_pos(rhos = c(0.4, 0.5), n_studies = 1e3)

fastpos documentation built on Oct. 23, 2020, 7:12 p.m.