model_3pl: 3-parameter-logistic model

Description Usage Arguments Value Examples

Description

Common computations and operations for the 3PL model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
model_3pl_prob(t, a, b, c, D = 1.702)

model_3pl_info(t, a, b, c, D = 1.702)

model_3pl_lh(u, t, a, b, c, D = 1.702, log = FALSE)

model_3pl_rescale(t, a, b, c, scale = c("t", "b"), mean = 0, sd = 1)

model_3pl_gendata(n_p, n_i, t = NULL, a = NULL, b = NULL, c = NULL,
  D = 1.702, t_dist = c(0, 1), a_dist = c(-0.1, 0.2), b_dist = c(0,
  0.7), c_dist = c(5, 46), t_bounds = c(-3, 3), a_bounds = c(0.01,
  2.5), b_bounds = c(-3, 3), c_bounds = c(0, 0.5), missing = NULL,
  ...)

model_3pl_plot(a, b, c, D = 1.702, type = c("prob", "info"),
  total = FALSE, xaxis = seq(-4, 4, 0.1))

model_3pl_plot_loglh(u, a, b, c, D = 1.702, xaxis = seq(-4, 4, 0.1),
  verbose = FALSE)

Arguments

t

ability parameters, 1d vector

a

discrimination parameters, 1d vector

b

difficulty parameters, 1d vector

c

guessing parameters, 1d vector

D

the scaling constant, default=1.702

u

observed responses, 2d matrix

log

True to return log-likelihood

scale

the scale, 't' for theta or 'b' for b-parameters

mean

the mean of the new scale

sd

the standard deviation of the new scale

n_p

the number of people to be generated

n_i

the number of items to be generated

t_dist

parameters of the normal distribution used to generate t-parameters

a_dist

parameters of the lognormal distribution used to generate a-parameters

b_dist

parameters of the normal distribution used to generate b-parameters

c_dist

parameters of the beta distribution used to generate c-parameters

t_bounds

bounds of the ability parameters

a_bounds

bounds of the discrimination parameters

b_bounds

bounds of the difficulty parameters

c_bounds

bounds of the guessing parameters

missing

the proportion or number of missing responses

...

additional arguments

type

the type of plot: 'prob' for item characteristic curve (ICC) and 'info' for item information function curve (IIFC)

total

TRUE to sum values over items

xaxis

the values of x-axis

verbose

TRUE to print rough maximum likelihood estimates

Value

model_3pl_prob returns the resulting probabilities in a matrix

model_3pl_info returns the resulting information in a matrix

model_3pl_lh returns the resulting likelihood in a matrix

model_3pl_rescale returns t, a, b, c parameters on the new scale

model_3pl_gendata returns the generated response matrix and parameters in a list

model_3pl_plot returns a ggplot object

model_3pl_plot_loglh returns a ggplot object

Examples

1
2
3
4
5
6
7
8
with(model_3pl_gendata(10, 5), model_3pl_prob(t, a, b, c))
with(model_3pl_gendata(10, 5), model_3pl_info(t, a, b, c))
with(model_3pl_gendata(10, 5), model_3pl_lh(u, t, a, b, c))
model_3pl_gendata(10, 5)
model_3pl_gendata(10, 5, a=1, c=0, missing=.1)
with(model_3pl_gendata(10, 5), model_3pl_plot(a, b, c, type="prob"))
with(model_3pl_gendata(10, 5), model_3pl_plot(a, b, c, type="info", total=TRUE))
with(model_3pl_gendata(5, 50), model_3pl_plot_loglh(u, a, b, c))

Example output

           [,1]      [,2]      [,3]      [,4]      [,5]
 [1,] 0.8870785 0.3407184 0.1443273 0.5071048 0.3293704
 [2,] 0.9817774 0.7763845 0.3678983 0.9191988 0.6297310
 [3,] 0.9508095 0.5218755 0.2085806 0.7524819 0.4561391
 [4,] 0.9738848 0.6909996 0.2981836 0.8757480 0.5666616
 [5,] 0.8567608 0.3060520 0.1336395 0.4330291 0.2990348
 [6,] 0.9846091 0.8109599 0.4049292 0.9343881 0.6584702
 [7,] 0.9421204 0.4801214 0.1918999 0.7103238 0.4291292
 [8,] 0.9948975 0.9468962 0.6739610 0.9840502 0.8175577
 [9,] 0.9964261 0.9660391 0.7511757 0.9899910 0.8554453
[10,] 0.9393800 0.4686746 0.1875721 0.6976192 0.4216124
            [,1]      [,2]      [,3]       [,4]       [,5]
 [1,] 0.14522139 0.5388499 0.7577803 0.66072336 0.32198046
 [2,] 0.05833167 0.3240979 0.3291778 0.02832659 0.08115209
 [3,] 0.17392816 0.2594866 0.3721514 0.70558869 0.32168318
 [4,] 0.17659229 0.2035522 0.2886531 0.61545662 0.30074522
 [5,] 0.06614561 0.3963745 0.4151290 0.04527184 0.10139155
 [6,] 0.15986808 0.4221772 0.6074677 0.77001089 0.33952462
 [7,] 0.06545955 0.3901455 0.4074778 0.04354040 0.09955350
 [8,] 0.08801329 0.5660334 0.6501711 0.13133363 0.16453896
 [9,] 0.12407754 0.6351796 0.8419515 0.43156526 0.27241326
[10,] 0.17659007 0.2036246 0.2887614 0.61559828 0.30077914
           [,1]      [,2]      [,3]       [,4]      [,5]
 [1,] 0.3748935 0.8886263 0.6146971 0.96325864 0.3720642
 [2,] 0.7559848 0.9544539 0.2491149 0.98589057 0.7602875
 [3,] 0.5132242 0.2329148 0.5292424 0.91362771 0.5110525
 [4,] 0.3007970 0.9305647 0.3081481 0.97798309 0.2971334
 [5,] 0.6901468 0.9261394 0.6824267 0.97648082 0.6937035
 [6,] 0.8922485 0.8561130 0.9162319 0.21175244 0.1265105
 [7,] 0.4429361 0.7139391 0.4252745 0.88801338 0.4453470
 [8,] 0.6273407 0.1099050 0.6170243 0.03620682 0.6301927
 [9,] 0.5834448 0.3218598 0.6020444 0.86913268 0.5807493
[10,] 0.8665709 0.8200242 0.8907620 0.69711509 0.8504959
$u
      [,1] [,2] [,3] [,4] [,5]
 [1,]    1    1    1    0    1
 [2,]    0    1    1    1    1
 [3,]    0    0    1    0    1
 [4,]    0    0    0    0    1
 [5,]    0    0    0    0    0
 [6,]    0    1    1    1    1
 [7,]    1    1    1    0    0
 [8,]    1    1    1    1    1
 [9,]    1    0    1    1    0
[10,]    1    1    0    1    1

$t
 [1] -0.38784786  0.61560924 -0.63451438 -0.72272853 -1.82819455 -0.56524350
 [7]  0.16816658  1.03678349  0.09468902 -0.16171096

$a
[1] 0.7082492 1.3321956 1.0916045 0.9259809 0.7003574

$b
[1]  0.80793482 -1.08601687 -1.09060077  0.02083232 -0.16302320

$c
[1] 0.14913749 0.06048293 0.11420052 0.08306087 0.15897911

$u
      [,1] [,2] [,3] [,4] [,5]
 [1,]    0    1    0    1    1
 [2,]    0    1    0    0    1
 [3,]    0    1    0    1    0
 [4,]    1   NA    1    1    1
 [5,]    0    0    0    0    1
 [6,]   NA    0    0    1   NA
 [7,]    1    1    1    1    0
 [8,]    0    1    1    1    1
 [9,]    0    0    0    0    1
[10,]   NA    1   NA    1    1

$t
 [1]  0.3132369 -0.5582359 -0.7256920  1.7150836 -1.5299602 -0.8423131
 [7]  0.5425216  0.8067298 -0.7778198  2.0032878

$a
[1] 1 1 1 1 1

$b
[1]  1.06627483 -0.30438123 -0.01022385 -0.05949673 -0.69397656

$c
[1] 0 0 0 0 0

Rirt documentation built on Oct. 30, 2019, 12:13 p.m.

Related to model_3pl in Rirt...