llike_score {irtQ} | R Documentation |
Log-Likelihood of Ability Parameters
Description
This function computes the log-likelihood values for a set of ability parameters, given item parameters and response data
Usage
llike_score(
x,
data,
theta,
D = 1,
method = "ML",
norm.prior = c(0, 1),
fence.a = 3,
fence.b = NULL,
missing = NA
)
Arguments
x |
A data frame containing item metadata (e.g., item parameters, number
of categories, IRT model types, etc.). See |
data |
A matrix of examinees' item responses corresponding to the items
specified in the |
theta |
A numeric vector of ability values at which to evaluate the log-likelihood function. |
D |
A scaling constant used in IRT models to make the logistic function closely approximate the normal ogive function. A value of 1.7 is commonly used for this purpose. Default is 1. |
method |
A character string specifying the estimation method. Available options include:
|
norm.prior |
A numeric vector of length two specifying the mean and
standard deviation of the normal prior distribution (used only when |
fence.a |
A numeric value specifying the item slope parameter (i.e., a-parameter) for the two imaginary items used in MLF. See Details below. Default is 3.0. |
fence.b |
A numeric vector of length two specifying the lower and upper
bounds of the item difficulty parameters (i.e., b-parameters) for the two
imaginary items in MLF. If |
missing |
A value indicating missing responses in the data set. Default
is |
Details
This function evaluates the log-likelihood of a given ability
(theta
) for one or more examinees, based on item parameters (x
) and item
response data (data
).
If method = "MLF"
is selected, the function appends two virtual "fence"
items to the item pool with fixed parameters. These artificial items help
avoid unstable likelihood functions near the boundaries of the ability scale.
For example, to compute the log-likelihood curves of two examinees' responses
to the same test items, supply a 2-row matrix to data
and a vector of
ability values to theta
.
Value
A data frame of log-likelihood values.
Each row corresponds to an ability value (
theta
).Each column corresponds to an examinee’s response pattern.
Examples
## Import the "-prm.txt" output file from flexMIRT
flex_sam <- system.file("extdata", "flexmirt_sample-prm.txt", package = "irtQ")
# Read item parameters and convert them to item metadata
x <- bring.flexmirt(file = flex_sam, "par")$Group1$full_df
# Generate ability values from N(0, 1)
set.seed(10)
score <- rnorm(5, mean = 0, sd = 1)
# Simulate response data
data <- simdat(x = x, theta = score, D = 1)
# Specify ability values for log-likelihood evaluation
theta <- seq(-3, 3, 0.5)
# Compute log-likelihood values (using MLE)
llike_score(x = x, data = data, theta = theta, D = 1, method = "ML")