calculatePermutedScoreByGeneSampling {integIRTy} | R Documentation |
Calculate the permuted latent trait by gene sampling
Description
Given the original binary matrix and item parameters, calculate the permuted latent trait by gene sampling. Basically this function permutes within columns and recompute the latent trait using pre-specified item parameters and the permuted binary matrix.
Usage
calculatePermutedScoreByGeneSampling(originalMat, dscrmn = dscrmn,
dffclt = dffclt, c = rep(0, length(dffclt)), fold = 1, parallel=FALSE)
Arguments
originalMat |
The original response matrix |
dscrmn |
The estimated item discrimination parameter |
dffclt |
The estimated item difficulty parameter |
c |
The estimated item guessing parameter if available |
fold |
The fold relative to the number of genes present should gene sampling achieve. Default is 1, meaning equal number of genes are sampled. Increasing fold would increase the precesion in estimating empirical P value |
parallel |
Logical indicating whether to use parallel computing with foreach package as backend. |
Details
Both gene sampling and sample label permutation can be used to infer the null distribution of altent traits. For sample label permutation, one can simply first construct the binary matrix after permuting the sample labels and feed it to computeAbility() function together with item parameters
Value
A vector of null latent traits by gene sampling
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, computeAbility
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 null latent trait by gene sampling
scoreNull <- calculatePermutedScoreByGeneSampling(X, dffclt=dffclt,
dscrmn=dscrmn, fold=1)