According to the TAM documentation, one has to supply a matrice for the items parameters (difficulty and discrimination)
B.fixed An optional matrix with four columns for fixing matrix entries in 2PL estimation. 1st column: item index, 2nd column: category, 3rd column: dimension, 4th column: fixed value.
Does the following code use the right syntax?
# Example data
n_cand <- 10
n_items <- 3
data <- matrix(sample(0:1, n_cand * n_items, replace = TRUE), nrow = n_cand, ncol = n_items)
# Define fixed item difficulties and discriminations
xsi.fixed <- cbind(1:n_items, diff = c(-1, 0, 1.2)) # arbitrary values
b.fixed <- cbind(1:n_items, category = 0, dimension = 1, discr = c(1, 1.2, 0.9)) # Example values
# Fit the 2PL model
library(TAM)
mod <- tam.mml.2pl(resp = data, xsi.fixed = xsi.fixed, B.fixed = b.fixed)
According to the TAM documentation, one has to supply a matrice for the items parameters (difficulty and discrimination)
B.fixed An optional matrix with four columns for fixing matrix entries in 2PL estimation. 1st column: item index, 2nd column: category, 3rd column: dimension, 4th column: fixed value.
Does the following code use the right syntax?
# Example data
n_cand <- 10
n_items <- 3
data <- matrix(sample(0:1, n_cand * n_items, replace = TRUE), nrow = n_cand, ncol = n_items)
# Define fixed item difficulties and discriminations
xsi.fixed <- cbind(1:n_items, diff = c(-1, 0, 1.2)) # arbitrary values
b.fixed <- cbind(1:n_items, category = 0, dimension = 1, discr = c(1, 1.2, 0.9)) # Example values
# Fit the 2PL model
library(TAM)
mod <- tam.mml.2pl(resp = data, xsi.fixed = xsi.fixed, B.fixed = b.fixed)
Share
Improve this question
edited Mar 18 at 9:21
Julien
asked Mar 17 at 15:55
JulienJulien
1,7921 gold badge14 silver badges32 bronze badges
1 Answer
Reset to default 0OP needs to fix the loading for every category of the respective items, whereas the category
column is a counter starting with 1. That ist, the category column can't be 0
. Note that OP also needs to free the variance of the person distribution for estimation if the discrimination parameters are fixed.
Try
n_cand <- 10
n_items <- 3
data <- matrix(sample(0:1, n_cand * n_items, replace = TRUE), nrow = n_cand, ncol = n_items)
# Define fixed item difficulties and discriminations
xsi.fixed <- cbind(1:n_items, diff = c(-1, 0, 1.2)) # arbitrary values
b.fixed <- rbind(
cbind(1:n_items, category = 1, dimension = 1, discr = c(0, 0, 0)),
cbind(1:n_items, category = 2, dimension = 1, discr = c(1, 1.2, 0.9))) # Example values
# Fit the 2PL model
mod <- tam.mml.2pl(resp = data, xsi.fixed = xsi.fixed, B.fixed = b.fixed,
est.variance = TRUE)
mod$B
mod$variance