computeAbility {integIRTy} | R Documentation |
Calculate latent traits for a given response matrix and item parameters using MLE
Description
This function calculates the MLE of latent traits for a given response matrix with rows being examinees and columns being items for given item parameters.
Usage
computeAbility(respMat, dscrmn = dscrmn, dffclt = dffclt,
c = rep(0, length(dffclt)), parallel=FALSE)
Arguments
respMat |
The response matrix of 0 and 1 with rows being examinees and columns being items. |
dscrmn |
A vector of item discrimination parameter. |
dffclt |
A vector of item difficulty parameter. |
c |
A vector of guessing parameter. Default is set to all 0 indicating no guessing allowed. |
parallel |
Logical indicating whether to use parallel computing with foreach package as backend. |
Details
This function is a wrapper of the thetaEst() function from catR package (Magis, 2012).
Value
A vector of latent trait estimates for each examinee.
Author(s)
Pan Tong (nickytong@gmail.com), Kevin R Coombes (krc@silicovore.com)
References
David Magis, Gilles Raiche (2012). Random Generation of Response Patterns under Computerized Adaptive Testing with the R Package catR. Journal of Statistical Software, 48(8), 1-31.
See Also
fitOnSinglePlat, intIRTeasyRun, calculatePermutedScoreByGeneSampling
Examples
# number of items and number of genes
nSample <- 10
nGene <- 2000
set.seed(1000)
a <- rgamma(nSample, shape=1, scale=1)
b <- rgamma(nSample, shape=1, scale=1)
# true latent traits
theta <- rnorm(nGene, mean=0)
# probability of correct response (P_ij) for gene i in sample j
P <- matrix(NA, nrow=nGene, ncol=nSample)
for(i in 1:nSample){
P[, i] <- exp(a[i]*(theta-b[i]))/(1+exp(a[i]*(theta-b[i])))
}
# binary matrix
X <- matrix(NA, nrow=nGene, ncol=nSample)
for(i in 1:nSample){
X[, i] <- rbinom(nGene, size=1, prob=P[, i])
}
# IRT fitting
fit2PL <- fitOnSinglePlat(X, model=3)
dffclt <- coef(fit2PL$fit)[, 'Dffclt']
dscrmn <- coef(fit2PL$fit)[, 'Dscrmn']
# estimated latent trait
score <- computeAbility(X, dffclt=dffclt, dscrmn=dscrmn)