drop_fixed: Drop or Add Fixed Dimensions for Multinomial...

View source: R/auxiliary.R

drop_fixedR Documentation

Drop or Add Fixed Dimensions for Multinomial Probabilities/Frequencies

Description

Switches between two representation of polytopes for multinomial probabilities (whether the fixed parameters are included).

Usage

drop_fixed(x, options = 2)

add_fixed(x, options = 2, sum = 1)

Arguments

x

a vector (typically k, n, or prior) or a matrix (typically A or V), in which case the fixed dimensions are dropped/added column-wise.

options

number of observable categories/probabilities for each item type/multinomial distribution, e.g., c(3,2) for a ternary and binary item.

sum

a vector that determines the fixed sum in each multinomial condition. By default, probabilities are assumed that sum to one. If frequencies n are provided, use sum=n.

Examples

######## bi- and trinomial (a1,a2, b1,b2,b3)
# vectors with frequencies:
drop_fixed(c(3, 7, 4, 1, 5), options = c(2, 3))
add_fixed(c(3, 4, 1),
  options = c(2, 3),
  sum = c(10, 10)
)

# matrices with probabilities:
V <- matrix(c(
  1, 0, 0,
  1, .5, .5,
  0, 1, 0
), 3, byrow = TRUE)
V2 <- add_fixed(V, options = c(2, 3))
V2
drop_fixed(V2, c(2, 3))

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