Learn R Programming

statsr (version 0.2.0)

bayes_inference: Bayesian hypothesis tests and credible intervals

Description

Bayesian hypothesis tests and credible intervals

Usage

bayes_inference(
  y,
  x = NULL,
  data,
  type = c("ci", "ht"),
  statistic = c("mean", "proportion"),
  success = NULL,
  null = NULL,
  cred_level = 0.95,
  alternative = c("twosided", "less", "greater"),
  hypothesis_prior = c(H1 = 0.5, H2 = 0.5),
  n_0 = 1,
  beta_prior = NULL,
  beta_prior1 = NULL,
  beta_prior2 = NULL,
  verbose = TRUE,
  show_summ = verbose,
  show_res = verbose,
  show_plot = verbose
)

Arguments

y

Response variable, can be numerical or categorical

x

Explanatory variable, categorical (optional)

data

Name of data frame that y and x are in

type

of inference; "ci" (credible interval) or "ht" (hypothesis test)

statistic

population parameter to estimate: mean or proportion

success

which level of the categorical variable to call "success", i.e. do inference on

null

null value for the hypothesis test

cred_level

confidence level, value between 0 and 1

alternative

direction of the alternative hypothesis; "less","greater", or "twosided"

hypothesis_prior

discrete prior for H1 and H2, default is the uniform prior: c(H1=0.5,H2=0.5)

n_0

Prior sample size for calculating the Bayes factor of the twosided test of one mean

beta_prior, beta_prior1, beta_prior2

beta priors for p (or p_1 and p_2) for one or two proportion inference

verbose

whether output should be verbose or not, default is TRUE

show_summ

print summary stats, set to verbose by default

show_res

print results, set to verbose by default

show_plot

print inference plot, set to verbose by default

Value

Results of inference task performed