全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 IRT理论相关软件
5762 11
2017-10-31
如题,下面介绍是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:
      a  b   c
1 0.588 -1 0.0
2 1.000  1 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:
      a  b   c
1 0.588 -1 0.0
2 1.000  1 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:
      a  b   c
1 0.588 -1 0.0
2 1.000  1 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:
      a  b   c
1 0.588 -1 0.0
2 1.000  1 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:
      a  b   c
1 0.588 -1 0.0
2 1.000  1 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)
附件列表

xxIRT_2.0.3.zip

大小:88.34 KB

 马上下载

xxIRT.pdf

大小:102.86 KB

 马上下载

二维码

扫码加我 拉你入群

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

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

全部回复
2017-10-31 19:21:18
jiandong4388 发表于 2017-10-31 19:13
如题,下面介绍是R语言刚刚出来不久的IRT包:xxIRT。感兴趣可以下载试试。具体代码如下:


谢谢分享
二维码

扫码加我 拉你入群

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

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

2017-11-1 07:48:52
多谢无私分享。
二维码

扫码加我 拉你入群

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

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

2017-11-1 17:20:24
二维码

扫码加我 拉你入群

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

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

2017-11-3 09:32:18
包名 就叫xxIRT吗
二维码

扫码加我 拉你入群

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

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

2017-11-3 09:39:32
145xyz 发表于 2017-11-3 09:32
包名 就叫xxIRT吗
是的。。
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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