Perform a robustness analysis by systematically varying the values of the alternative prior

bfrr(
likelihood,
alternative_prior,
null_prior,
parameters,
steps = 100L,
cutoff = 3L,
multicore = TRUE
)

## Arguments

likelihood

likelihood object representing the data

alternative_prior

prior object for the alternative prior

null_prior

prior object for the null prior

parameters

list of min and max values for each parameter to vary over.

steps

numeric the number of steps each parameter is varied over. (Default: 100 steps)

cutoff

Minimum Bayes factor value for evidence for the hypothesis (Default: 3)

multicore

Run robustness analysis across multiple cores (Default: TRUE if available)

## Value

A robustness object

## Examples


# define a likelihood
data_model <- likelihood(family = "normal", mean = 1, sd = 5)

# define the alternative prior
alternative_prior <- prior(family = "normal", mean = 5, sd = 4)

# define the null prior
null_prior <- prior(family = "point", point = 0L)

# set the parameters to vary and the range to vary them across
# vary the mean from -10 to 5
# vary the sd from 1 to 5
parameters <- list(mean = c(-10, 5), sd = c(1, 5))

# mark all Bayes factors larger/smaller than 3/.3 as evidence for the
# alternative / null
cutoff <- 3
bfrr(data_model, alternative_prior, null_prior, parameters, steps = 10,
cutoff,
multicore = FALSE
)
#> Prior robustness analysis:
#>
#>   Alternative prior
#>   -----------------
#>     Family
#>       normal
#>     Parameters
#>       mean: 5
#>       sd: 4
#>
#>   Null prior
#>   -----------------
#>     Family
#>       point
#>     Parameters
#>       point: 0
#>
#>   Likelihood
#>   -----------------
#>     Family
#>       normal
#>     Parameters
#>       mean: 1
#>       sd: 5
#>
#>  The original parameters gave a Bayes factor of 0.66.
#> Using the cutoff value of 3, this result is inconclusive.
#>
#> 2 parameters of the alternative prior were varied for the robutness analysis:
#>   The mean was varied from -10 to 5 (step size: 1.5)
#>   The sd was varied from 1 to 5 (step size: 0.4)
#>
#> Outcome
#> -----------------
#> 25 of 100 (0.25) tested priors provided evidence for H0 (BF < 0.33)
#>
#> 0 of 100 (0) tested priors provided evidence for H1 (BF > 3)
#>
#> 75 of 100 (0.75) tested priors were inconclusive (0.33 < BF < 3)
#>
#> The conclusion of 'Inconclusive' was robust over 0.75 tested priors
#>