This function computes the loglikelihoods of individual items given the item parameters, ability values, and response data.
llike_item(x, data, score, D = 1, use.aprior = FALSE,
use.bprior = FALSE, use.gprior = FALSE, aprior = list(dist =
"lnorm", params = c(0, 0.5)), bprior = list(dist = "norm", params =
c(0, 1)), gprior = list(dist = "beta", params = c(5, 17)),
missing = NA)A data frame containing the item metadata (e.g., item parameters, number of categories, models ...).
See irtfit, test.info or simdat for more details about the item metadata.
This data frame can be easily obtained using the function shape_df. If prob = NULL, this data frame is
used in the recursion formula. See below for details.
A matrix containing examinees' response data for the items in the argument x. A row and column indicate
the examinees and items, respectively.
A vector of examinees' ability estimates. Length of the vector must be the same as the number of rows in the response data set.
A scaling factor in IRT models to make the logistic function as close as possible to the normal ogive function (if set to 1.7). Default is 1.
A logical value. If TRUE, a prior distribution for the slope parameters is used when computing the loglikelihood values across all items. Default is FALSE.
A logical value. If TRUE, a prior distribution for the difficulty (or threshold) parameters is used when computing the loglikelihood values across all items. Default is FALSE.
A logical value. If TRUE, a prior distribution for the guessing parameters is used when computing the loglikelihood values across all 3PLM items. Default is TRUE.
A list containing the information of the prior distribution for item slope parameters. Three probability distributions
of Beta, Log-normal, and Normal distributions are available. In the list, a character string of the distribution name must be specified
in the first internal argument and a vector of two numeric values for the two parameters of the distribution must be specified in the
second internal argument. Specifically, when Beta distribution is used, "beta" should be specified in the first argument. When Log-normal
distribution is used, "lnorm" should be specified in the first argument. When Normal distribution is used, "norm" should be specified
in the first argument. In terms of the two parameters of the three distributions, see dbeta(), dlnorm(), and dnorm()
in the stats package for more details.
A list containing the information of the prior distribution for item difficulty (or threshold) parameters. Three probability distributions
of Beta, Log-normal, and Normal distributions are available. In the list, a character string of the distribution name must be specified
in the first internal argument and a vector of two numeric values for the two parameters of the distribution must be specified in the
second internal argument. Specifically, when Beta distribution is used, "beta" should be specified in the first argument. When Log-normal
distribution is used, "lnorm" should be specified in the first argument. When Normal distribution is used, "norm" should be specified
in the first argument. In terms of the two parameters of the three distributions, see dbeta(), dlnorm(), and dnorm()
in the stats package for more details.
A list containing the information of the prior distribution for item guessing parameters. Three probability distributions
of Beta, Log-normal, and Normal distributions are available. In the list, a character string of the distribution name must be specified
in the first internal argument and a vector of two numeric values for the two parameters of the distribution must be specified in the
second internal argument. Specifically, when Beta distribution is used, "beta" should be specified in the first argument. When Log-normal
distribution is used, "lnorm" should be specified in the first argument. When Normal distribution is used, "norm" should be specified
in the first argument. In terms of the two parameters of the three distributions, see dbeta(), dlnorm(), and dnorm()
in the stats package for more details.
A value indicating missing values in the response data set. Default is NA.
A vector of loglikelihood values. Each element represents a sum of loglikeihoods across all ability values for each item.
# NOT RUN {
## import the "-prm.txt" output file from flexMIRT
flex_sam <- system.file("extdata", "flexmirt_sample-prm.txt", package = "irtplay")
# select the first two dichotomous items and last polytomous item
x <- bring.flexmirt(file=flex_sam, "par")$Group1$full_df[c(1:2, 55), ]
# generate examinees' abilities from N(0, 1)
set.seed(10)
score <- rnorm(10, mean=0, sd=1)
# simulate the response data
data <- simdat(x=x, theta=score, D=1)
# compute the loglikelihood values (no priors are used)
llike_item(x, data, score, D=1, use.aprior=FALSE, use.gprior=FALSE)
# }
Run the code above in your browser using DataLab