| fitIRT | R Documentation |
This function fits a binary Item Response Theory (IRT) model using various parameters and options.
fitIRT(
dat,
score = "score",
id = "id",
item = "Item",
scale = "Scale",
pl = 1,
personDat = NA,
personPreds = character(),
itemDat = NA,
AitemPreds = character(),
BitemPreds = character(),
CitemPreds = character(),
DitemPreds = character(),
itemSpecificBetas = FALSE,
betaScale = 10,
invspAMeandat = 0.542,
invspASD = 2,
BMeandat = 0,
BSD = 10,
logitCMeandat = -4,
logitCSD = 2,
logitDMeandat = 4,
logitDSD = 2,
AbilityMeandat = array(0, dim = c(length(unique(dat[[scale]])))),
AbilitySD = array(10, dim = c(length(unique(dat[[scale]])))),
AbilityCorr = diag(1, c(length(unique(dat[[scale]])))),
AMeanSD = 1,
BMeanSD = BSD,
logitCMeanSD = logitCSD,
logitDMeanSD = logitDSD,
AbilityMeanSD = array(1, dim = c(length(unique(dat[[scale]])))),
iter = 2000,
cores = 6,
carefulfit = FALSE,
ebayes = TRUE,
ebayesmultiplier = 2,
ebayesFromFixed = FALSE,
ebayesiter = 1,
estMeans = c("ability", "B", "C", "D"),
priors = TRUE,
integrateEachAbility = FALSE,
integrateEachAbilityFixedSE = FALSE,
mml = FALSE,
NintegratePoints = 5,
normalise = FALSE,
normaliseScale = 1,
normaliseMean = 0,
dropPerfectScores = TRUE,
trainingRows = 1:nrow(dat),
init = NA,
tol = 1e-08 * 10^(log(nrow(dat), 10)),
...
)
dat |
A data frame containing the data to be analyzed. |
score |
Character. The name of the column in |
id |
Character. The name of the column in |
item |
Character. The name of the column in |
scale |
Character. The name of the column in |
pl |
Integer. The number of parameters for the logistic model (1PL, 2PL, 3PL, or 4PL). Default is 1. |
personDat |
Data frame. Any fixed ability data for persons. Default is NA. |
personPreds |
Character vector. Names of predictors for person parameters found in data. Default is an empty character vector. |
itemDat |
Data frame. Any fixed item data. Default is NA. |
AitemPreds |
Character vector. Names of predictors for item discrimination parameters. Default is an empty character vector. |
BitemPreds |
Character vector. Names of predictors for item difficulty parameters. Default is an empty character vector. |
CitemPreds |
Character vector. Names of predictors for item guessing parameters. Default is an empty character vector. |
DitemPreds |
Character vector. Names of predictors for item upper asymptote (slipping) parameters. Default is an empty character vector. |
itemSpecificBetas |
Logical. Whether to allow item-specific betas for covariate effects, or simply estimate one effect per covariate. Default is FALSE. |
betaScale |
Numeric. Scale of the prior for beta parameters. Default is 10. |
invspAMeandat |
Numeric. Mean for the prior distribution of the raw discrimination parameters, which subsequently have a 'softplus' log(1+exp(x)) applied. Default is 0.542, giving a mean for A pars of ~ 1. |
invspASD |
Numeric. Standard deviation for the prior distribution of the raw discrimination parameters. Default is 2. |
BMeandat |
Numeric. Mean for the prior distribution of the item difficulty parameters. Default is 0. |
BSD |
Numeric. Standard deviation for the prior distribution of the item difficulty parameters. Default is 10. |
logitCMeandat |
Numeric. Mean for the prior distribution of the item guessing parameters (on logit scale). Default is -4. |
logitCSD |
Numeric. Standard deviation for the prior distribution of the item guessing parameters (on logit scale). Default is 2. |
logitDMeandat |
Numeric. Mean for the prior distribution of the item upper asymptote parameters (on logit scale). Default is 4. |
logitDSD |
Numeric. Standard deviation for the prior distribution of the item upper asymptote parameters (on logit scale). Default is 2. |
AbilityMeandat |
Numeric array. Mean for the prior distribution of the ability parameters. Default is 0 for each scale. |
AbilitySD |
Numeric array. Standard deviation for the prior distribution of the ability parameters. Default is 10 for each scale. |
AbilityCorr |
Matrix. Correlation matrix for the ability parameters. Default is an identity matrix. |
AMeanSD |
Numeric. Standard deviation for the prior distribution of the discrimination parameters. Default is 1. |
BMeanSD |
Numeric. Standard deviation for the prior distribution of the difficulty parameters. Default is |
logitCMeanSD |
Numeric. Standard deviation for the prior distribution of the guessing parameters (on logit scale). Default is |
logitDMeanSD |
Numeric. Standard deviation for the prior distribution of the upper asymptote parameters (on logit scale). Default is |
AbilityMeanSD |
Numeric array. Standard deviation for the prior distribution of the ability parameters. Default is 1 for each scale. |
iter |
Integer. Maximum number of iterations for the fitting algorithm. Default is 2000. |
cores |
Integer. Number of cores to use for parallel computation. Default is 6. |
carefulfit |
Logical. Whether to use a slower, careful fitting procedure. Default is FALSE. Experimental. |
ebayes |
Logical. Whether to use empirical Bayes estimation. Default is TRUE. With ebayes, the priors are adapted based on a first pass estimate. |
ebayesmultiplier |
Numeric. Multiplier for the widths of the empirical Bayes priors. Default is 2, as this appears to work better in practice. |
ebayesFromFixed |
Logical. Whether to initialize empirical Bayes from any specifed fixed values Default is FALSE. |
ebayesiter |
Integer. Number of iterations for empirical Bayes estimation. Default is 1. |
estMeans |
Character vector. Which means to estimate from 'ability', 'A', 'B', 'C', 'D'. Default is c('ability', 'B', 'C', 'D'), with discrimination means fixed. |
priors |
Logical. Whether to use prior distributions. Default is TRUE. |
integrateEachAbility |
Logical. Whether to integrate across each ability. Default is FALSE. |
integrateEachAbilityFixedSE |
Logical. Whether to integrate each ability with fixed standard error. Default is FALSE. |
mml |
Logical. Experimental and not working well. Whether to use marginal maximum likelihood estimation. Default is FALSE. |
NintegratePoints |
Integer. Number of integration points for numerical integration. Default is 5. |
normalise |
Logical. Whether to normalize the output estimates. Default is FALSE. |
normaliseScale |
Numeric. Scale for normalization. Default is 1. |
normaliseMean |
Numeric. Mean for normalization. Default is 0. |
dropPerfectScores |
Logical. Whether to drop perfect scores from each subject and item before estimation. Default is TRUE. |
trainingRows |
Integer vector. Rows of data to use for estimation of parameters. Default is all rows in |
init |
Initial values for the fitting algorithm. Default is NA. |
tol |
Numeric. Tolerance for convergence. Default attempts to sensibly adjust for amount of data. |
... |
Additional arguments passed to the fitting function. |
A list containing the fitted IRT model parameters and additional information about the fit.
#Generate some data (here 2pl model
require(data.table)
dat <- simIRT(Nsubs = 50,Nitems = 100,Nscales = 1,
logitCMean = -10,logitCSD = 0,AMean = 1,ASD = .3,
BMean=0,BSD = .5,
AbilityMean = 0,AbilitySD = 1)
#fit using bigIRT
fit <- fitIRT(dat$dat,cores=2,score = 'score',id = 'id',
scale = 'Scale',item = 'Item', pl=2)
print(fit$personPars)
print(fit$itemPars)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.