如何从IRT模型中R的特定点获取拟合曲线的值?

时间:2018-11-16 18:10:41

标签: r

因此,使用此代码,我有一些适合IRT分级响应模型的数据:

hdat <- read.csv("data.csv", header=TRUE)


library("mirt")


model.grm <- 'height = 1-9'
results.grm <- mirt(data=hdat, model=model.grm, itemtype="graded", SE=TRUE, verbose=FALSE)
coef.grm <- coef(results.grm, IRTpars=TRUE, simplify=TRUE)
items.grm <- as.data.frame(coef.grm$items)
print(items.grm)

png(filename="plot.png")

plot(results.grm, type = 'trace', which.items = c(1),
main = "", par.settings = simpleTheme(lty=1:4,lwd=2),
auto.key=list(points=FALSE,lines=TRUE, columns=4))

dev.off()

我得到这张图:

graph

我如何找出在theta = -1时说P2的值?

我认为要绘制图形的对象是results.grm@ParObjects$pars[[1]],其中包含以下内容:

Formal class 'graded' [package "mirt"] with 23 slots
  ..@ par          : num [1:5] 4.888 2.815 0.561 -1.728 -5.509
  ..@ SEpar        : num [1:5] 0.0421 0.0311 0.0252 0.0279 0.0472
  ..@ parnames     : chr [1:5] "a1" "d1" "d2" "d3" ...
  ..@ est          : Named logi [1:5] TRUE TRUE TRUE TRUE TRUE
  .. ..- attr(*, "names")= chr [1:5] "a1" "d1" "d2" "d3" ...
  ..@ dps          :function ()  
  ..@ dps2         :function ()  
  ..@ constr       : logi(0) 
  ..@ itemclass    : int 2
  ..@ parnum       : Named int [1:5] 1 2 3 4 5
  .. ..- attr(*, "names")= chr [1:5] "a1" "d1" "d2" "d3" ...
  ..@ nfact        : int 1
  ..@ nfixedeffects: num 0
  ..@ fixed.design : num [1, 1] 0
  ..@ dat          : num [1, 1] 0
  ..@ ncat         : int 5
  ..@ gradient     : num(0) 
  ..@ hessian      : num [1:5, 1:5] -4814 1846 362 -1200 -2266 ...
  ..@ itemtrace    : num[0 , 0 ] 
  ..@ lbound       : num [1:5] -Inf -Inf -Inf -Inf -Inf
  ..@ ubound       : num [1:5] Inf Inf Inf Inf Inf
  ..@ any.prior    : logi FALSE
  ..@ prior.type   : int [1:5] 0 0 0 0 0
  ..@ prior_1      : num [1:5] NaN NaN NaN NaN NaN
  ..@ prior_2      : num [1:5] NaN NaN NaN NaN NaN

1 个答案:

答案 0 :(得分:1)

probtrace(extract.item(results.grm,1),c(-1))应该可以工作-而且,可能有助于查看https://github.com/philchalmers/mirt/issues/21