View source: R/simulateBinaryResponseMat.R
simulateBinaryResponseMat | R Documentation |
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.
simulateBinaryResponseMat(a = a, b = b, theta = theta)
a |
A vector of item discrimination parameter |
b |
A vector of item difficulty parameter |
theta |
A vector of true latent traits |
This function is not necessary for the integration purpose. It serves as a utility function to help the user conduct simulation.
A matrix of 0's and 1's where rows are genes (examinees) and columns are samples (items).
Pan Tong (nickytong@gmail.com), Kevin R Coombes (krc@silicovore.com)
computeAbility, fitOnSinglePlat, intIRTeasyRun
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.