Skip to contents

Bayesian IRT likelihood (deterministic part of CJR machinery)

Usage

morie_spatial_voting_bayesian_irt_likelihood(votes, x, alpha, beta)

Arguments

votes

Binary matrix.

x

Ideal points.

alpha

Difficulty.

beta

Discrimination.

Value

List with loglik, vote_probs, n_correct, n_total, accuracy.

References

Clinton J, Jackman S & Rivers D (2004). The statistical analysis of roll call data. American Political Science Review, 98(2), 355-370.

Examples

set.seed(1)
v <- matrix(stats::rbinom(20, 1, 0.5), 4, 5)
morie_spatial_voting_bayesian_irt_likelihood(
  v, matrix(rnorm(4), 4, 1), rep(0, 5), matrix(rnorm(5), 5, 1))
#> $loglik
#> [1] -22.8751
#> 
#> $vote_probs
#>             [,1]      [,2]      [,3]      [,4]       [,5]
#> [1,] 0.955495577 0.4729208 0.4902364 0.9231919 0.89279069
#> [2,] 0.669504991 0.4930121 0.4974820 0.6435441 0.62557175
#> [3,] 0.242322034 0.5111349 0.5040125 0.2788204 0.30496411
#> [4,] 0.006362319 0.5396351 0.5143016 0.0182948 0.03447414
#> 
#> $n_correct
#> [1] 9
#> 
#> $n_total
#> [1] 20
#> 
#> $accuracy
#> [1] 0.45
#>