Learn R Programming

CDM (version 1.0-0)

sim.din: Data Simulation Tool for DINA, DINO and mixed DINA and DINO Data

Description

sim.din can be used to simulate dichotomous response data according to a CDM model. The model type DINA or DINO can be specified item wise. The number of items, the sample size, and two parameters for each item, the slipping and guessing errors, can be set explicitly.

Usage

sim.din(N, q.matrix, guess = rep(0.2, nrow(q.matrix)),
    slip = guess, mean = rep(0, ncol(q.matrix)), Sigma =                          
    diag(ncol(q.matrix)), rule = "DINA")

Arguments

N
a required numeric value specifying the number $N$ of requested response patterns.
q.matrix
a required binary $J$ times $K$ matrix describing which of the $K$ attributes are required, coded by 1, and which attributes are not required, coded by 0, to master the items.
guess
an optional vector of guessing parameters. Default is 0.2 for each item.
slip
an optional vector of slipping parameters. Default is 0.2 for each item.
mean
a numeric vector of length ncol(q.matrix) indicating the latent trait of the respondents. Default is rep(0, length = ncol(q.matrix)). That is, having a probability of 0.5 for possessing each of the attr
Sigma
a matrix of dimension ncol(q.matrix) times ncol(q.matrix) specifying the covariance matrix of atrribute possessions. Default is diag( 1, ncol(q.matrix)). That is, the possession of the attributes
rule
an optional character string or vector of character strings specifying the model rule that is used. The character strings must be of "DINA" or "DINO". If a vector of character strings is specified, implying an it

Value

  • A matrix of simulated dichotoumos response data according to the specified CDM model.

References

Rupp, A. A., Templin, J. L. and Henson, R. A. (2010) Diagnostic Measurement: Theory, Methods, and Applications. New York: The Guilford Press.

See Also

Data-sim for artificial date set simulated with the help of this method; plot.din, the S3 method for plotting objects of the class din; summary.din, the S3 method for summarizing objects of the class din, which creates objects of the class summary.din; print.summary.din, the S3 method for printing objects of the class summary.din; din, the main function for DINA and DINO parameter estimation, which creates objects of the class din. See also CDM-package for general information about this package.

Examples

Run this code
## simulate DINA and DINO data according to a tetrachoric correlation

# define Q-matrix for 4 items and 2 attributes
q.matrix <- matrix(c(1,0,0,1,1,1,1,1), ncol = 2, nrow = 4)

# Slipping parameters 
slip <- c(0.2,0.3,0.4,0.3)

# Guessing parameters
guess <- c(0,0.1,0.05,0.2)

set.seed(1567) # fix random numbers
dat1 <- sim.din(N = 200, q.matrix, slip, guess,
  # Possession of the attributes with high probability 
  mean = c(0.5,0.2), 
  # Possession of the attributes is weakly correlated
  Sigma = matrix(c(1,0.2,0.2,1), ncol=2), rule = "DINA")
head(dat1)

set.seed(15367) # fix random numbers
dat2 <- sim.din(N = 200, q.matrix, slip, guess, mean = 
  c(0.5,0.2), Sigma = matrix(c(1,0.2,0.2,1), ncol=2),
  rule = "DINO")
head(dat2)

Run the code above in your browser using DataLab