搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  xxIRT_2.0.3.zip
资料下载链接地址: https://bbs.pinggu.org/a-2351212.html
附件大小:
88.34 KB   举报本内容
如题,下面介绍是R语言刚刚出来不久的IRT包:xxIRT。感兴趣可以下载试试。具体代码如下:


library(xxIRT)
### create a 3pl model using given parameters
theta <- c(-1, 0, 1)
a <- c(.588, 1)
b <- c(-1, 1)
c <- c(0, .2)
u <- matrix(c(1, 0, 1, 0, 1, 0), nrow=3)
people <- data.frame(theta=theta)
items <- data.frame(a=a, b=b, c=c)
# create 3pl model using different arguments
model_3pl(people=people, items=items, responses=u)
model_3pl(people=people, items=items)
model_3pl(theta=theta, a=a, b=b, c=c)
model_3pl(people=people, a=a, b=b, c=c)
model_3pl(theta=theta, items=items)
# compute Probability, Information, Likelihood by calling itself
x <- model_3pl(people=people, items=items, responses=u)
x$P(x)
x$I(x)
x$L(x)
# compute Probability, Information, Likelihood by calling the class object
model_3pl()$P(x)
model_3pl()$I(x)
model_3pl()$L(x)
### create a 3PL model using generated data
x <- model_3pl()$gendata(5, 3)
x$P(x)
x$I(x)
x$L(x)


a 3pl model: 3 people, 2 items, with responses.
snapshot of people:
theta
1 -1
2 0
3 1
snapshot of items:
ab c
1 0.588 -1 0.0
2 1.0001 0.2
snapshot of responses:
[,1] [,2]
[1,] 1 0
[2,] 0 1
[3,] 1 0
> model_3pl(people=people, items=items)
a 3pl model: 3 people, 2 items, without responses.
snapshot of people:
theta
1 -1
2 0
3 1
snapshot of items:
ab c
1 0.588 -1 0.0
2 1.0001 0.2
snapshot of responses:
NULL
> model_3pl(theta=theta, a=a, b=b, c=c)
a 3pl model: 3 people, 2 items, without responses.
snapshot of people:
theta
1 -1
2 0
3 1
snapshot of items:
ab c
1 0.588 -1 0.0
2 1.0001 0.2
snapshot of responses:
NULL
> model_3pl(people=people, a=a, b=b, c=c)
a 3pl model: 3 people, 2 items, without responses.
snapshot of people:
theta
1 -1
2 0
3 1
snapshot of items:
ab c
1 0.588 -1 0.0
2 1.0001 0.2
snapshot of responses:
NULL
> model_3pl(theta=theta, items=items)
a 3pl model: 3 people, 2 items, without responses.
snapshot of people:
theta
1 -1
2 0
3 1
snapshot of items:
ab c
1 0.588 -1 0.0
2 1.0001 0.2
snapshot of responses:
NULL
>
> # compute Probability, Information, Likelihood by calling itself
> x <- model_3pl(people=people, items=items, responses=u)
> x$P(x)
item.1 item.2
[1,] 0.5000000 0.2258364
[2,] 0.7309799 0.3235722
[3,] 0.8807131 0.6000000
> x$I(x)
item.1 item.2
[1,] 0.2498000 0.01033284
[2,] 0.1964910 0.14414837
[3,] 0.1049735 0.48166667
> x$L(x)
item.1 item.2
[1,] 0.5000000 0.7741636
[2,] 0.2690201 0.3235722
[3,] 0.8807131 0.4000000
>
> # compute Probability, Information, Likelihood by calling the class object
> model_3pl()$P(x)
item.1 item.2
[1,] 0.5000000 0.2258364
[2,] 0.7309799 0.3235722
[3,] 0.8807131 0.6000000
> model_3pl()$I(x)
item.1 item.2
[1,] 0.2498000 0.01033284
[2,] 0.1964910 0.14414837
[3,] 0.1049735 0.48166667
> model_3pl()$L(x)
item.1 item.2
[1,] 0.5000000 0.7741636
[2,] 0.2690201 0.3235722
[3,] 0.8807131 0.4000000
>
> ### create a 3PL model using generated data
> x <- model_3pl()$gendata(5, 3)
> x$P(x)
item.1 item.2 item.3
[1,] 0.6314424 0.09929907 0.2820528
[2,] 0.8781537 0.17149607 0.5999434
[3,] 0.9289669 0.25990548 0.7315110
[4,] 0.7487130 0.11331046 0.3909783
[5,] 0.8298876 0.13799996 0.5058170
> x$I(x)
item.1 item.2 item.3
[1,] 0.5255876 0.007305597 0.3283107
[2,] 0.2704684 0.203111414 0.5943207
[3,] 0.1693673 0.505613136 0.5164087
[4,] 0.4528021 0.030729564 0.4877337
[5,] 0.3510574 0.094624243 0.5805796
> x$L(x)
item.1 item.2 item.3
[1,] 0.6314424 0.9007009 0.2820528
[2,] 0.8781537 0.8285039 0.4000566
[3,] 0.9289669 0.7400945 0.7315110
[4,] 0.7487130 0.8866895 0.6090217
[5,] 0.8298876 0.8620000 0.5058170








x$L(x)x$I(x)x$P(x)x <- model_3pl()$gendata(5, 3)### create a 3PL model using generated datamodel_3pl()$L(x)model_3pl()$I(x)model_3pl()$P(x)# compute Probability, Information, Likelihood by calling the class objectx$L(x)x$I(x)x$P(x)x <- model_3pl(people=people, items=items, responses=u)# compute Probability, Information, Likelihood by calling itselfmodel_3pl(theta=theta, items=items) model_3pl(people=people, a=a, b=b, c=c) model_3pl(theta=theta, a=a, b=b, c=c) model_3pl(people=people, items=items) model_3pl(people=people, items=items, responses=u) # create 3pl model using different argumentsitems <- data.frame(a=a, b=b, c=c)people <- data.frame(theta=theta)u <- matrix(c(1, 0, 1, 0, 1, 0), nrow=3)c <- c(0, .2)b <- c(-1, 1)a <- c(.588, 1)theta <- c(-1, 0, 1)### create a 3pl model using given parameterslibrary(xxIRT)


    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

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

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

GMT+8, 2026-2-10 21:50