One draw per row of theta_mat. Repeat rows for repeated draws. Usually
reached through draw(fam(theta), n).
Arguments
Value
(M, K) numeric matrix, one observation per row, drawn from the
parameter in the matching row of theta_mat.
See also
compile_loglik(), the density half of the same pair.
Examples
set.seed(1)
fam <- multinomial_family(n_trials = 4L, k = 3L)
# Five draws from one parameter: repeat it across five rows.
kernel_draw(fam, matrix(c(0.5, 0.3, 0.2), nrow = 5L, ncol = 3L, byrow = TRUE))
#> [,1] [,2] [,3]
#> [1,] 1 1 2
#> [2,] 2 0 2
#> [3,] 2 1 1
#> [4,] 3 0 1
#> [5,] 1 3 0
# One draw from each of three different parameters.
kernel_draw(fam, rbind(c(0.5, 0.3, 0.2), c(0.2, 0.2, 0.6), c(0.9, 0.05, 0.05)))
#> [,1] [,2] [,3]
#> [1,] 1 2 1
#> [2,] 0 2 2
#> [3,] 3 1 0