This function aims to find several possible distribution that would give rise to the observed sample parameters. For that, you need to pass a list of parameters, created with set_parameters

find_possible_distributions(
  parameters,
  n_distributions = 10,
  seed = NULL,
  return_tibble = TRUE,
  return_failures = FALSE
)

Arguments

parameters

List of parameters, see set_parameters

n_distributions

The target number of distributions to return.

seed

An integer to use as the seed for random number generation. Set this in scripts to ensure reproducibility. Explicit seeds leave the caller's random number generator state unchanged.

return_tibble

Should a tibble, rather than a list, be returned? Requires the tibble-package, ignored if that package is not available.

return_failures

Should distributions that failed to produce the desired SD be returned? Defaults to false

Value

A tibble or list (depending on the return_tibble argument) with:

outcome

success or failure - character

distribution

The distribution that was found (if success) / whose SD came closest to the target during the search (if failure) - numeric

mean

The exact mean of the distribution - numeric

sd

The SD of the distribution that was found (success) / that came closest (failure) - numeric

iterations

The number of SD adjustments attempted on the first search that found this distribution. Zero if its initial candidate succeeded; on failure, the total number attempted.

Details

A successful search supplies one compatible reconstruction. Search failure does not prove impossibility, and the frequencies with which reconstructions are found do not estimate probabilities for the original data. Rounding ties are accepted in either direction.

Examples


sprite_parameters <- set_parameters(mean = 2.2, sd = 1.3, n_obs = 20,
                                    min_val = 1, max_val = 5)

find_possible_distributions(sprite_parameters, 5, seed = 1234)
#> # A tibble: 5 × 6
#>      id outcome distribution  mean    sd iterations
#>   <int> <chr>   <list>       <dbl> <dbl>      <dbl>
#> 1     1 success <dbl [20]>    2.25  1.25          0
#> 2     2 success <dbl [20]>    2.25  1.25          1
#> 3     3 success <dbl [20]>    2.15  1.31          4
#> 4     4 success <dbl [20]>    2.25  1.33          0
#> 5     5 success <dbl [20]>    2.25  1.33          1