simulate_pos | R Documentation |

Runs several simulations and returns the points of stability, which can then be further processed to calculate the critical point of stability. This function should only be used if you need the specific points of stability. For instance, if you want to study the method in more detail and the higher level functions are not sufficient.

simulate_pos( x_pop, y_pop, n_studies, sample_size_min, sample_size_max, replace, lower_limit, upper_limit, progress )

`x_pop` |
First vector of population. |

`y_pop` |
Second vector of population. |

`n_studies` |
How many studies to conduct. |

`sample_size_min` |
Minimum sample size to start in corridor of stability. |

`sample_size_max` |
How many participants to draw at maximum. |

`replace` |
Whether drawing samples is with replacement or not. |

`lower_limit` |
Lower limit of corridor of stability. |

`upper_limit` |
Upper limit of corridor of stability. |

`progress` |
Should progress bar be displayed? Boolean, default is FALSE. |

If you just want to calculate a quantile of the distribution, use the main
function of the package `find_critical_pos()`

).

Vector of sample sizes at which corridor of stability was reached.

# set up a population pop <- fastpos::create_pop(rho = 0.5, size = 1e6) # create a distribution of points of stability pos <- simulate_pos(x_pop = pop[,1], y_pop = pop[,2], n_studies = 100, sample_size_min = 20, sample_size_max = 1e3, replace = TRUE, lower_limit = 0.4, upper_limit = 0.6, progress = TRUE) # calculate quantiles or any other parameter of the distribution quantile(pos, c(.8, .9, .95))

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.