simulateBinaryResponseMat: Simulate binary response matrix according to 2-parameter Item...

View source: R/simulateBinaryResponseMat.R

simulateBinaryResponseMatR Documentation

Simulate binary response matrix according to 2-parameter Item Characteristic Function for given latent traits and item parameters.

Description

This function generates binary response matrix according to the Item Characteristic Function for specified item parameter and latent traits. It can be used for simulation purposes.

Usage

simulateBinaryResponseMat(a = a, b = b, theta = theta)

Arguments

a

A vector of item discrimination parameter

b

A vector of item difficulty parameter

theta

A vector of true latent traits

Details

This function is not necessary for the integration purpose. It serves as a utility function to help the user conduct simulation.

Value

A matrix of 0's and 1's where rows are genes (examinees) and columns are samples (items).

Author(s)

Pan Tong (nickytong@gmail.com), Kevin R Coombes (krc@silicovore.com)

See Also

computeAbility, fitOnSinglePlat, intIRTeasyRun

Examples

# number of samples and genes to simulate
nSample <- 50
nGene <- 1000
# mean and variance of item parameters
meanDffclt_Expr <- 3; varDffclt_Expr <- 0.2
meanDscrmn_Expr <- 1.5; varDscrmn_Expr <- 0.1
# generate item parameters from gamma distribution
set.seed(1000)
Dffclt_Expr <-  rgamma(nSample, shape=meanDffclt_Expr^2/varDffclt_Expr,
                      scale=varDffclt_Expr/meanDffclt_Expr)
Dscrmn_Expr <-  rgamma(nSample, shape=meanDscrmn_Expr^2/varDscrmn_Expr,
                      scale=varDscrmn_Expr/meanDscrmn_Expr)
# generate latent trait
theta <- rnorm(nGene)
# the binary response matrix
binary_Expr <- simulateBinaryResponseMat(a=Dscrmn_Expr, b=Dffclt_Expr, theta=theta)
dim(binary_Expr)

integIRTy documentation built on May 3, 2022, 9:08 a.m.