model_gpcm {Rirt}R Documentation

Generalized Partial Credit Model

Description

Common computations and operatoins for the GPCM

Usage

model_gpcm_prob(t, a, b, d, D = 1.702, d0 = NULL)

model_gpcm_info(t, a, b, d, D = 1.702, d0 = NULL)

model_gpcm_lh(u, t, a, b, d, D = 1.702, d0 = NULL, log = FALSE)

model_gpcm_gendata(n_p, n_i, n_c, t = NULL, a = NULL, b = NULL,
  d = NULL, D = 1.702, sort_d = FALSE, t_dist = c(0, 1),
  a_dist = c(-0.1, 0.2), b_dist = c(0, 0.8), d_dist = c(0, 1),
  t_bounds = c(-3, 3), a_bounds = c(0.01, 2.5), b_bounds = c(-3, 3),
  d_bounds = c(-3, 3), missing = NULL, ...)

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

model_gpcm_plot(a, b, d, D = 1.702, d0 = NULL, type = c("prob",
  "info"), item_level = FALSE, total = FALSE, xaxis = seq(-6, 6,
  0.1))

model_gpcm_plot_loglh(u, a, b, d, D = 1.702, d0 = NULL,
  xaxis = seq(-6, 6, 0.1), verbose = FALSE)

Arguments

t

ability parameters, 1d vector

a

discrimination parameters, 1d vector

b

item location parameters, 1d vector

d

item category parameters, 2d vector

D

the scaling constant, default=1.702

d0

insert an initial category value

u

observed scores (starting from 0), 2d matrix

log

TRUE to return log-likelihood

n_p

the number of people to be generated

n_i

the number of items to be generated

n_c

the number of score categories

sort_d

TRUE to sort d parameters for each item

t_dist

parameters of the normal distribution used to generate t-parameters

a_dist

parameters of the lognormal distribution parameters of a-parameters

b_dist

parameters of the normal distribution used to generate b-parameters

d_dist

parameters of the normal distribution used to generate d-parameters

t_bounds

the bounds of the ability parameters

a_bounds

the bounds of the discrimination parameters

b_bounds

the bounds of the difficulty parameters

d_bounds

the bounds of the category parameters

missing

the proportion or number of missing responses

...

additional arguments

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

type

the type of plot, prob for ICC and info for IIFC

item_level

TRUE to add item level data

total

TRUE to sum values over items

xaxis

the values of x-axis

verbose

TRUE to print rough maximum likelihood values

Details

Use NA to represent unused category.

Value

model_gpcm_prob returns the resulting probabilities in a 3d array

model_gpcm_info returns the resulting information in a 3d array

model_gpcm_lh returns the resulting likelihood in a matrix

model_gpcm_gendata returns the generated response matrix and parameters

model_gpcm_rescale returns t, a, b, d parameters on the new scale

model_gpcm_plot returns a ggplot object

model_gpcm_plot_loglh returns a ggplot object

Examples

with(model_gpcm_gendata(10, 5, 3), model_gpcm_prob(t, a, b, d))
with(model_gpcm_gendata(10, 5, 3), model_gpcm_info(t, a, b, d))
with(model_gpcm_gendata(10, 5, 3), model_gpcm_lh(u, t, a, b, d))
model_gpcm_gendata(10, 5, 3)
model_gpcm_gendata(10, 5, 3, missing=.1)
# Figure 1 in Muraki, 1992 (APM)
b <- matrix(c(-2,0,2,-.5,0,2,-.5,0,2), nrow=3, byrow=TRUE)
model_gpcm_plot(a=c(1,1,.7), b=rowMeans(b), d=rowMeans(b)-b, D=1.0, d0=0)
# Figure 2 in Muraki, 1992 (APM)
b <- matrix(c(.5,0,NA,0,0,0), nrow=2, byrow=TRUE)
model_gpcm_plot(a=.7, b=rowMeans(b, na.rm=TRUE), d=rowMeans(b, na.rm=TRUE)-b, D=1.0, d0=0)
# Figure 3 in Muraki, 1992 (APM)
b <- matrix(c(1.759,-1.643,3.970,-2.764), nrow=2, byrow=TRUE)
model_gpcm_plot(a=c(.778,.946), b=rowMeans(b), d=rowMeans(b)-b, D=1.0, d0=0)
# Figure 1 in Muraki, 1993 (APM)
b <- matrix(c(0,-2,4,0,-2,2,0,-2,0,0,-2,-2,0,-2,-4), nrow=5, byrow=TRUE)
model_gpcm_plot(a=1, b=rowMeans(b), d=rowMeans(b)-b, D=1.0)
# Figure 2 in Muraki, 1993 (APM)
b <- matrix(c(0,-2,4,0,-2,2,0,-2,0,0,-2,-2,0,-2,-4), nrow=5, byrow=TRUE)
model_gpcm_plot(a=1, b=rowMeans(b), d=rowMeans(b)-b, D=1.0, type='info', item_level=TRUE)
with(model_gpcm_gendata(5, 50, 3), model_gpcm_plot_loglh(u, a, b, d))

[Package Rirt version 0.0.2 Index]