View source: R/simulate_DDT_functions.R
simulate_lcm_response | R Documentation |
Generate multivariate binary responses from the following process:
For individual i = 1, ..., N, draw Z_i
from Categorical distribution with prior class probability (length K).
For item j = 1, ..., J, given Z_i = k
, draw Y_{ij}
from Binomial with class-item probability
simulate_lcm_response(N, response_prob, class_probability)
N |
number of individuals |
response_prob |
a K by J matrix, where the k,j-th element is the response probability of item j for individuals in class k |
class_probability |
a length K vector, where the k-th element is the probability of assigning an individual to class k. It does not have to sum up to 1 |
a named list of the following elements:
response_matrix
a K by J matrix with entries between 0
and 1
for the item
response probabilities.
class_probability
a K-vector with entries between 0 and 1 for the class probabilities. Entries should be nonzero and sum up to 1, or otherwise will be normalized
Other simulate DDT-LCM data:
simulate_DDT_tree()
,
simulate_lcm_given_tree()
,
simulate_parameter_on_tree()
# number of latent classes
K <- 6
# number of items
J <- 78
response_prob <- matrix(runif(K*J), nrow = K)
class_probability <- rep(1/K, K)
# number of individuals
N <- 100
response_matrix <- simulate_lcm_response(N, response_prob, class_probability)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.