multibridge (version 1.1.0)

mult_bf_informed: Evaluates Informed Hypotheses on Multinomial Parameters

Description

Evaluates informed hypotheses on multinomial parameters. These hypotheses can contain (a mixture of) inequality constraints, equality constraints, and free parameters. Informed hypothesis \(H_r\) states that category proportions obey the particular constraint. \(H_r\) can be tested against the encompassing hypothesis \(H_e\) or the null hypothesis \(H_0\). Encompassing hypothesis \(H_e\) states that category proportions are free to vary. Null hypothesis \(H_0\) states that category proportions are exactly equal.

Usage

mult_bf_informed(
  x,
  Hr,
  a = rep(1, length(x)),
  factor_levels = NULL,
  cred_level = 0.95,
  niter = 5000,
  bf_type = "LogBFer",
  seed = NULL,
  maxiter = 1000,
  nburnin = niter * 0.05
)

Value

List consisting of the following elements

$bf_list

gives an overview of the Bayes factor analysis:

  • bf_type: string. Contains Bayes factor type as specified by the user

  • bf: data.frame. Contains Bayes factors for all Bayes factor types

  • error_measures: data.frame. Contains for the overall Bayes factor the approximate relative mean-squared error re2, the approximate coefficient of variation cv, and the approximate percentage error percentage

  • logBFe_equalities: data.frame. Lists the log Bayes factors for all independent equality constrained hypotheses

  • logBFe_inequalities: data.frame. Lists the log Bayes factor for all independent inequality constrained hypotheses

$cred_level

numeric. User specified credible interval

$restrictions

list that encodes informed hypothesis for each independent restriction:

  • full_model: list containing the hypothesis, parameter names, data and prior specifications for the full model.

  • equality_constraints: list containing the hypothesis, parameter names, data and prior specifications for each equality constrained hypothesis.

  • inequality_constraints: list containing the hypothesis, parameter names, data and prior specifications for each inequality constrained hypothesis. In addition, in nr_mult_equal and nr_mult_free encodes which and how many parameters are equality constraint or free, in boundaries includes the boundaries of each parameter, in nineq_per_hyp states the number of inequality constraint parameters per independent inequality constrained hypothesis, and in direction states the direction of the inequality constraint.

$bridge_output

list containing output from bridge sampling function:

  • eval: list containing the log prior or posterior evaluations (q11) and the log proposal evaluations (q12) for the prior or posterior samples, as well as the log prior or posterior evaluations (q21) and the log proposal evaluations (q22) for the samples from the proposal distribution

  • niter: number of iterations of the iterative updating scheme

  • logml: estimate of log marginal likelihood

  • hyp: evaluated inequality constrained hypothesis

  • error_measures: list containing in re2 the approximate relative mean-squared error for the marginal likelihood estimate, in cv the approximate coefficient of variation for the marginal likelihood estimate (assumes that bridge estimate is unbiased), and in percentage the approximate percentage error of the marginal likelihood estimate

$samples

list containing a list for prior samples and a list of posterior samples from truncated distributions which were used to evaluate inequality constraints. Prior and posterior samples of independent inequality constraints are again saved in separate lists. Samples are stored as matrix of dimension nsamples x nparams.

Arguments

x

numeric. Vector with data

Hr

string or character. Encodes the user specified informed hypothesis. Use either specified factor_levels or indices to refer to parameters. See ``Note'' section for details on how to formulate informed hypotheses

a

numeric. Vector with concentration parameters of Dirichlet distribution. Must be the same length as x. Default sets all concentration parameters to 1

factor_levels

character. Vector with category names. Must be the same length as x

cred_level

numeric. Credible interval for the posterior point estimates. Must be a single number between 0 and 1

niter

numeric. Vector with number of samples to be drawn from truncated distribution

bf_type

character. The Bayes factor type. When the informed hypothesis is compared to the encompassing hypothesis, the Bayes factor type can be LogBFer, BFer, or BFre. When the informed hypothesis is compared to the null hypothesis, the Bayes factor type can be LogBFr0, BF0r, or BFr0. Default is LogBFer

seed

numeric. Sets the seed for reproducible pseudo-random number generation

maxiter

numeric. Maximum number of iterations for the iterative updating scheme used in the bridge sampling routine. Default is 1,000 to avoid infinite loops

nburnin

numeric. A single value specifying the number of burn-in samples when drawing from the truncated distribution. Minimum number of burn-in samples is 10. Default is 5% of the number of samples. Burn-in samples are removed automatically after the sampling.

Details

The model assumes that data follow a multinomial distribution and assigns a Dirichlet distribution as prior for the model parameters (i.e., underlying category proportions). That is: $$x ~ Multinomial(N, \theta)$$ $$\theta ~ Dirichlet(\alpha)$$

References

damien2001samplingmultibridge

gronau2017tutorialmultibridge

fruhwirth2004estimatingmultibridge

sarafoglou2020evaluatingPreprintmultibridge

See Also

Other functions to evaluate informed hypotheses: binom_bf_equality(), binom_bf_inequality(), binom_bf_informed(), mult_bf_equality(), mult_bf_inequality()

Examples

Run this code
# data
x <- c(3, 4, 10, 11, 7, 30)
# priors
a <- c(1, 1, 1, 1, 1, 1)
# restricted hypothesis
factor_levels <- c('theta1', 'theta2', 'theta3', 'theta4', 'theta5', 
'theta6')
Hr            <- c('theta1', '<',  'theta2', '&', 'theta3', '=', 'theta4', 
',', 'theta5', '<', 'theta6')
output_total  <- mult_bf_informed(x, Hr, a, factor_levels, seed=2020, niter=2e3)

Run the code above in your browser using DataCamp Workspace