Learn R Programming

xxIRT (version 2.0.3)

model_3pl: 3-Parameter-Logistic Model

Description

Create a 3-parameter-logistic (3PL) model object

Usage

model_3pl(people = NULL, items = NULL, responses = NULL, theta = NULL,
  a = NULL, b = NULL, c = NULL)

# S3 method for model.3pl print(x, ...)

# S3 method for model.3pl plot(x, ...)

Arguments

people

people parameters (data.frame)

items

item parameters (data.frame)

responses

dichotomous responses (data.frame or matrix)

theta

the ability parameters (vector)

a

the discrimination parameters (vector)

b

the difficulty parameters (vector)

c

the pseudo-guessing parameters (vector)

x

a model.3pl object

...

additional arguments

Details

A 3pl model contains people (people parameters), items (item parameters), responses (responses data), and functions to compute P (probability), I (information), and L (likelihood). Arguments are allowed to be NULL. The people argument needs to have a column named theta. The items argument needs to have columns named a, b, and c. The responses argument needs to be a data frame or matrix whose dimensionality matches with people and items.

In plot.model.3pl, use the stats argument to control what IRT statistics to draw. Use total argument to control whether to aggregate results over items or people.

Examples

Run this code
# NOT RUN {
# create a 3pl model using given parameters
theta <- c(-1, 0, 1)
a <- c(.5882, 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)
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 P(robability), I(nformation), L(ikelihood)
x <- model_3pl(people=people, items=items, responses=u)
x$P()
x$I()
x$L()
model_3pl()$P(x)
model_3pl()$I(x)
model_3pl()$L(x)
# create a 3pl model using generated data
x <- model_3pl()$gendata(10, 5)
x$P(x)
x$I(x)
x$L(x)
# draw test/item characteristic curve
x <- model_3pl()$gendata(20, 5)
plot(x, stats="prob")
plot(x, stats="prob", total=FALSE)
# draw test/iten information function
plot(x, stats="info")
plot(x, stats="info", total=FALSE)
# draw loglikelihood
plot(x, stats="loglik")
plot(x, stats="loglik", total=FALSE, theta=seq(-5, 5, .1))
# }

Run the code above in your browser using DataLab