mirt - 名义模型的奇数结果

时间:2017-01-16 07:22:10

标签: r

使用mirt包我获得(可能)我的名义模型的奇数结果。

 library(difNLR)
 library(mirt)
 data("GMATtest", "GMATkey")
 key <- as.numeric(as.factor(GMATkey))
 data <- sapply(1:20, function(i) as.numeric(GMATtest[, i]))
 colnames(data) <- paste("Item", 1:ncol(data))
 scoredGMAT <- key2binary(data, key)

 # 2PL IRT model for scored data
 mod0 <- mirt(scoredGMAT, 1)
 # nominal model for unscored data
 mod1 <- mirt(data, 1, 'nominal')

# plots of characteristic curves for item 1
itemplot(mod0, 1)
itemplot(mod1, 1)

enter image description here enter image description here

我预计,对于名义模型mod1,会有一条与我mod0所绘制的正确答案非常相似的曲线。然而,随着theta的增加,干扰者的概率似乎越来越大,这似乎并不合理。当然,数据可能有问题,或者(很可能)我错过了什么......

我已经检查了mirt帮助中的示例,结果与我预期的一样。

任何建议(可能是错误的)都将不胜感激!

最后一件事 - 我也试图适应2PLNRM模型,但我的R会话中止了。有人注意到同样的问题吗?我的代码:

# 2PLNRM model
mod2 <- mirt(data, 1, "2PLNRM", key = key)
coef(mod2)$`Item 1`
itemplot(mod2, 1)

修改 mirt包中有一个例子:

library(mirt)
data(SAT12)
SAT12[SAT12 == 8] <- NA #set 8 as a missing value
head(SAT12)

# correct answer key
key <- c(1, 4, 5, 2, 3, 1, 2, 1, 3, 1, 2, 4, 2, 1, 5, 3, 4, 4, 1, 4, 3, 
         3, 4, 1, 3, 5, 1, 3, 1, 5, 4, 5)
scoredSAT12 <- key2binary(SAT12, key)
mod0 <- mirt(scoredSAT12, 1)

# for first 5 items use 2PLNRM and nominal
scoredSAT12[, 1:5] <- as.matrix(SAT12[, 1:5])
mod1 <- mirt(scoredSAT12, 1, c(rep('nominal', 5), rep('2PL', 27)))

coef(mod0)$Item.1
coef(mod1)$Item.1

itemplot(mod0, 1)
itemplot(mod1, 1)

结果是我的预期,但是,当我尝试为所有项目拟合nominal模型时,曲线发生了变化:

# nominal for all items
mod1 <- mirt(SAT12, 1, 'nominal')
coef(mod1)$Item.1
itemplot(mod1, 1)

所以,正如你所说,似乎theta及其解释发生了变化,但为什么以及如何变化?

2 个答案:

答案 0 :(得分:1)

@Juan Bosco说这种行为是一致的。对所有项目使用名义响应模型的问题是,模型中增加的$ \ theta $值的方向并不明显,因为它的方向是任意的(毕竟,项目默认为“无序”)。

此外,由于mirt的默认参数化,假设最低/最高数值类别应与低/高$ \ theta $值相关联,这种类型的翻转在多选类型中很常见项目(其中,与评级量表排序的数据不同,应该没有直接关系),因为模型将选择与这些识别约束最佳匹配的方向。

要解决此问题,只需将最高固定评分系数替换为所提供的实际评分密钥,重新定义mirt使用的评分约束。像这样:

#starting values data.frame
sv <- mirt(data, 1, 'nominal', pars = 'values')
head(sv)

# set all values to 0 and estimated
sv$value[grepl('ak', sv$name)] <- 0
sv$est[grepl('ak', sv$name)] <- TRUE

nms <- colnames(data)
for(i in 1:length(nms)){

    #set highest category based on key fixed to 3
    pick <- paste0('ak', key[i]-1)
    index <- sv$item == nms[i] & pick == sv$name
    sv[index, 'value'] <- 3
    sv[index, 'est'] <- FALSE

    # set arbitrary lowest category fixed at 0
    if(pick == 'ak0') pick2 <- 'ak3'
    else pick2 <- paste0('ak', key[i]-2)
    index2 <- sv$item == nms[i] & pick2 == sv$name
    sv[index2, 'est'] <- FALSE
}

#estimate
mod2 <- mirt(data, 1, 'nominal', pars=sv)
plot(mod2, type = 'trace')
itemplot(mod2, 1)
coef(mod2, simplify=TRUE)

至少,这会告知模型哪个类别最高,因此提供足够的信息以完成更合适的方向。请注意,它确实不会影响每个模型对模型的解释,因为所有发生的情况是斜率乘以-1并且相应地调整评分系数。 HTH。

答案 1 :(得分:0)

好吧,正如Juan所说,问题是当使用不同的IRT模型时,θ的估计会发生变化。此外,2PLnominal模型的估算值之间存在某种联系。

library(difNLR)
library(mirt)
data("GMATtest", "GMATkey")
key <- as.numeric(as.factor(GMATkey))
data <- sapply(1:20, function(i) as.numeric(GMATtest[, i]))
colnames(data) <- paste("Item", 1:ncol(data))
scoredGMAT <- key2binary(data, key)

# 2PL IRT model for scored data
mod0 <- mirt(scoredGMAT, 1)
# nominal model for unscored data
mod1_all <- mirt(data, 1, 'nominal')
# nominal model for only first item
df <- data.frame(data[, 1], scoredGMAT[, 2:20])
mod1_1 <- mirt(df, 1, c('nominal', rep('2PL', 19)))

# plots of characteristic curves for item 1
itemplot(mod0, 1)
itemplot(mod1_all, 1)
itemplot(mod1_1, 1)

# factor scores
fs0 <- fscores(mod0)
fs1_all <- fscores(mod1_all)
fs1_1 <- fscores(mod1_1)


plot(fs1_all ~ fs0)
plot(fs1_1 ~ fs0)

enter image description here

# linear model
round(coef(lm(fs1_all ~ fs0)), 4)

(Intercept)         fs0 
    -0.0001     -0.9972 

这似乎是新的theta似乎&#39; ignoration&#39;而不是“知识”,因为它几乎减去了原始的theta。

感谢Juan的想法,他们真的很有帮助!

相关问题