R: Extraction functions for ab objects

extractors {abtest} | R Documentation

## Extraction functions for ab objects

### Description

Extraction functions for objects returned from the `ab_test` function.

### Usage

    get_bf(x, log = FALSE)

    get_prior_prob(x)

    get_post_prob(x)

    get_post_samples(x, hypothesis = "H1")

### Arguments

`x` | object of class `"ab"` as returned from `ab_test`.
`log` | determines whether the log Bayes factors are returned.
`hypothesis` | determines for which hypothesis posterior samples are returned. Needs to be either "H1", "H+", or "H-" (the default is "H1").

### Value

`get_bf` returns the Bayes factors in favor of "H1", "H+", and "H-" (compared to H0). `get_prior_prob` returns the prior probabilities of the hypotheses. `get_post_prob` returns the posterior probabilities of the hypotheses. `get_post_samples` returns posterior samples for the specified hypothesis.

### Examples

    # synthetic data
    data <- list(y1 = 10, n1 = 28, y2 = 14, n2 = 26)

    # Bayesian A/B test with default settings
    ab <- ab_test(data = data, posterior = TRUE)

    # extract Bayes factors
    get_bf(ab)

    # extract prior probabilities
    get_prior_prob(ab)

    # extract posterior probabilities
    get_post_prob(ab)

    # extract posterior samples for H1
    s <- get_post_samples(ab, hypothesis = "H1")

[Package abtest version 1.0.1 Index]