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)