全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 IRT理论相关软件
2919 9
2016-07-16
如题,今天就分享给大家基于R软件下的项目反应理论的两参数模型的实践代码。大家可以下载下来看看,具体操作就是把数据替换成自己的数据就可以,详细代码如下:library(ltm)

# the two parameter model
opm1 <- ltm(LSAT~z1)
opm2 <- ltm(LSAT~z1,control = list(optimizer = "nlminb"))

## Factor Scores for the two-parameter logistic model
factor.scores(opm1)

#Computes the residuals for vectors of response patterns
residuals(opm1)
residuals(opm1, order = FALSE)

#Computes the expected frequencies for vectors of response patterns
fitted(opm1, type = "conditional-probabilities")


#related ouput setting
coef(opm1)
vcov(opm1)
item.fit(opm1)
person.fit(opm1)
margins(opm1)
margins(opm1, "three")
anova(opm1,opm2)
summary(opm1)


# Cronbach's alpha for the LSAT data-set
# with a Bootstrap 95% CI
cronbach.alpha(LSAT, CI = TRUE)   #without bootsrapping
cronbach.alpha(LSAT, CI = TRUE, B = 500)


#plot opm

## Compare the Item Characteristic Curves for the LSAT data,
## under the constraint Rasch model, the unconstraint Rasch model,
## and the two parameter model assuming equal discrimination
## across items
par(mfrow = c(2, 2))
pl1 <- plot(rasch(LSAT, constr = cbind(length(LSAT) + 1, 1)))
text(2, 0.35, "Rasch model\nDiscrimination = 1")
pl2 <- plot(rasch(LSAT))
text(2, 0.35, "Rasch model")
pl3 <- plot(ltm(LSAT~z1))
text(2, 0.35, "Rasch model\nwith Guessing parameter")

## Compare the Item Characteristic Curves for Item 4
## (you have to run the above first)
plot(range(pl1[, "z"]), c(0, 1), type = "n", xlab = "Ability",
     ylab = "Probability", main = "Item Characteristic Curves - Item 4")
lines(pl1[, c("z", "Item 4")], lwd = 2, col = "black")
lines(pl2[, c("z", "Item 4")], lwd = 2, col = "red")
lines(pl3[, c("z", "Item 4")], lwd = 2, col = "blue")
legend("right", c("Rasch model Discrimination = 1", "Rasch model",
       "Rasch model with\nGuessing parameter"), lwd = 2, col = c("black",
       "red", "blue"), bty = "n")





附件列表

opm-two parameter model.zip

大小:1.84 KB

只需: 1 个论坛币  马上下载

2PL

本附件包括:

  • opm-two parameter model.txt
  • opm-two parameter model.R

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2016-7-17 12:56:11
thanks for your sharing, xie xie
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-7-17 15:03:41
xiexie1111 发表于 2016-7-17 12:56
thanks for your sharing, xie xie
不客气,一起学习。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-7-18 10:04:12
支持一下
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-7-18 11:43:15
xiexie1111 发表于 2016-7-17 12:56
thanks for your sharing, xie xie
不客气,一起学习欢迎指教
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-7-18 11:43:25
zishengzheqiang 发表于 2016-7-18 10:04
支持一下
谢谢支持
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群