Simulate data from the Dawid-Skene model

simulate_dawid_skene_model(pi, theta, sim_data, seed = NULL)

Arguments

pi

The pi parameter of the Dawid-Skene model.

theta

The theta parameter of the Dawid-Skene model.

sim_data

Data to guide the simulation. The data must be in the long data format used in rater() except without the 'rating' column. The data specifies:

  • the number of items in the data, and

  • which raters rate each item and how many times they do so.

seed

An optional random seed to use.

Value

The passed sim_data augmented with columns:

  • "z" containing the latent class of each item,

  • "rating" containing the simulated ratings.

Details

The number of raters implied by the entries in the rater column must match the number of raters implied by the passed theta parameter.

This function can also be used to simulate from the class-conditional Dawid-Skene model by specifying theta in the required form (i.e where all off-diagonal entries of the error matrices are equal.)

Examples


# \donttest{

J <- 5
K <- 4
pi <- rep(1 / K, K)
theta <- make_theta(0.7, J, K)
sim_data <- data.frame(item = rep(1:2, each = 5), rater = rep(1:5, 2))

simulations <- simulate_dawid_skene_model(pi, theta, sim_data)
simulations
#>    item rater z ratings
#> 1     1     1 2       2
#> 2     1     2 2       2
#> 3     1     3 2       2
#> 4     1     4 2       2
#> 5     1     5 2       2
#> 6     2     1 3       3
#> 7     2     2 3       4
#> 8     2     3 3       3
#> 9     2     4 3       3
#> 10    2     5 3       3

# }