ltm (version 1.0-0)

rmvlogis: Generate Random Responses Patterns under Dichotomous and Polytomous IRT models

Description

Produces Bernoulli or Multinomial random variates under the Rasch, the two-parameter logistic, the three parameter, the graded response, and the generalized partial credit models.

Usage

rmvlogis(n, thetas, IRT = TRUE, link = c("logit", "probit"), 
         distr = c("normal", "logistic", "log-normal", "uniform"), 
         z.vals = NULL)

rmvordlogis(n, thetas, IRT = TRUE, model = c("gpcm", "grm"), link = c("logit", "probit"), distr = c("normal", "logistic", "log-normal", "uniform"), z.vals = NULL)

Arguments

n

a scalar indicating the number of response patterns to simulate.

thetas

for rmvlogis() a numeric matrix with rows representing the items and columns the parameters. For rmvordlogis() a list with numeric vector elements, with first the threshold parameters and last the discrimination parameter. See Details for more info.

IRT

logical; if TRUE thetas are under the IRT parameterization. See Details for more info.

model

from which model to simulate.

link

a character string indicating the link function to use. Options are logit and probit.

distr

a character string indicating the distribution of the latent variable. Options are Normal, Logistic, log-Normal, and Uniform.

z.vals

a numeric vector of length n providing the values of the latent variable (ability) to be used in the simulation of the dichotomous responses; if specified the value of distr is ignored.

Value

a numeric matrix with n rows and columns the number of items, containing the simulated binary or ordinal variates.

Details

The binary variates can be simulated under the following parameterizations for the probability of correctly responding in the \(i\)th item. If IRT = TRUE $$\pi_i = c_i + (1 - c_i) g(\beta_{2i} (z - \beta_{1i})),$$ whereas if IRT = FALSE $$\pi_i = c_i + (1 - c_i) g(\beta_{1i} + \beta_{2i} z),$$ \(z\) denotes the latent variable, \(\beta_{1i}\) and \(\beta_{2i}\) are the first and second columns of thetas, respectively, and \(g()\) is the link function. If thetas is a three-column matrix then the third column should contain the guessing parameters \(c_i\)'s.

The ordinal variates are simulated according to the generalized partial credit model or the graded response model depending on the value of the model argument. Check gpcm and grm to see how these models are defined, under both parameterizations.

See Also

gpcm, grm, ltm, rasch, tpm

Examples

Run this code
# NOT RUN {
# 10 response patterns under a Rasch model
# with 5 items
rmvlogis(10, cbind(seq(-2, 2, 1), 1))

# 10 response patterns under a GPCM model
# with 5 items, with 3 categories each
thetas <- lapply(1:5, function(u) c(seq(-1, 1, len = 2), 1.2))
rmvordlogis(10, thetas)

# }

Run the code above in your browser using DataCamp Workspace