strategy_marginal: Log-Marginal Likelihood for Decision Strategy

View source: R/strategy_marginal.R

strategy_marginalR Documentation

Log-Marginal Likelihood for Decision Strategy

Description

Computes the logarithm of the marginal likelihood, defined as the integral over the likelihood function weighted by the prior distribution of the error probabilities.

Usage

strategy_marginal(k, n, strategy)

Arguments

k

observed frequencies of Option B. Either a vector or a matrix/data frame (one person per row).

n

vector with the number of choices per item type.

strategy

a list that defines the predictions of a strategy, seestrategy_multiattribute.

Examples

k <- c(1, 11, 18)
n <- c(20, 20, 20)
# pattern: A, A, B with constant error e<.50
strat <- list(
  pattern = c(-1, -1, 1),
  c = .5, ordered = FALSE,
  prior = c(1, 1)
)
m1 <- strategy_marginal(k, n, strat)
m1

# pattern: A, B, B with ordered error e1<e3<e2<.50
strat2 <- list(
  pattern = c(-1, 3, 2),
  c = .5, ordered = TRUE,
  prior = c(1, 1)
)
m2 <- strategy_marginal(k, n, strat2)
m2

# Bayes factor: Model 2 vs. Model 1
exp(m2 - m1)

multinomineq documentation built on Nov. 22, 2022, 5:09 p.m.