prob {irt} | R Documentation |
Calculate the probability of a correct response
Description
prob
Returns the probability of correct respond to an
item or multiple items with given parameters for a given ability or
abilities, i.e. \theta
. For polytomous models, where there are
multiple possible responses, probability of each response category will be
returned.
Usage
prob(ip, theta, derivative = 0)
## S4 method for signature 'Item'
prob(ip, theta, derivative = 0)
## S4 method for signature 'Rasch'
prob(ip, theta, derivative = 0)
## S4 method for signature '1PL'
prob(ip, theta, derivative = 0)
## S4 method for signature '2PL'
prob(ip, theta, derivative = 0)
## S4 method for signature '3PL'
prob(ip, theta, derivative = 0)
## S4 method for signature '4PL'
prob(ip, theta, derivative = 0)
## S4 method for signature 'GRM'
prob(ip, theta, derivative = 0)
## S4 method for signature 'PCM'
prob(ip, theta, derivative = 0)
## S4 method for signature 'GPCM'
prob(ip, theta, derivative = 0)
## S4 method for signature 'GPCM2'
prob(ip, theta, derivative = 0)
## S4 method for signature 'Itempool'
prob(ip, theta, derivative = 0)
## S4 method for signature 'Testlet'
prob(ip, theta, derivative = 0)
## S4 method for signature 'numMatDfListChar'
prob(ip, theta, derivative = 0)
Arguments
ip |
An |
theta |
An object containing the ability parameters. |
derivative |
Whether to calculate the first or second derivative of probability of a response.
|
Value
Item probabilities at given theta will be returned.
Author(s)
Emre Gonulates
Examples
theta <- rnorm(1)
item1 <- generate_item(model = "Rasch")
# Probability of correct response
prob(item1, theta)
# First derivative of probability of correct response:
prob(item1, theta, derivative = 1)
# Second derivative of probability of correct response:
prob(item1, theta, derivative = 2)
# Multiple theta values
theta_n <- rnorm(5)
prob(item1, theta_n)
prob(item1, theta_n, derivative = 1)
prob(item1, theta_n, derivative = 2)
theta <- rnorm(1)
item1 <- generate_item(model = "1PL")
# Probability of correct response
prob(item1, theta)
# First derivative of probability of correct response:
prob(item1, theta, derivative = 1)
# Second derivative of probability of correct response:
prob(item1, theta, derivative = 2)
# Multiple theta values
theta_n <- rnorm(5)
prob(item1, theta_n)
prob(item1, theta_n, derivative = 1)
prob(item1, theta_n, derivative = 2)
theta <- rnorm(1)
item1 <- generate_item(model = "2PL")
# Probability of correct response
prob(item1, theta)
# First derivative of probability of correct response:
prob(item1, theta, derivative = 1)
# Second derivative of probability of correct response:
prob(item1, theta, derivative = 2)
# Multiple theta values
theta_n <- rnorm(5)
prob(item1, theta_n)
prob(item1, theta_n, derivative = 1)
prob(item1, theta_n, derivative = 2)
theta <- rnorm(1)
item1 <- generate_item(model = "3PL")
# Probability of correct response
prob(item1, theta)
# First derivative of probability of correct response:
prob(item1, theta, derivative = 1)
# Second derivative of probability of correct response:
prob(item1, theta, derivative = 2)
# Multiple theta values
theta_n <- rnorm(5)
prob(item1, theta_n)
prob(item1, theta_n, derivative = 1)
prob(item1, theta_n, derivative = 2)
theta <- rnorm(1)
item1 <- generate_item(model = "4PL")
# Probability of correct response
prob(item1, theta)
# First derivative of probability of correct response:
prob(item1, theta, derivative = 1)
# Second derivative of probability of correct response:
prob(item1, theta, derivative = 2)
# Multiple theta values
theta_n <- rnorm(5)
prob(item1, theta_n)
prob(item1, theta_n, derivative = 1)
prob(item1, theta_n, derivative = 2)
theta <- rnorm(1)
item1 <- generate_item(model = "GRM")
# Probability of correct response
prob(item1, theta)
# First derivative of probability of correct response:
prob(item1, theta, derivative = 1)
# Multiple theta values
theta_n <- rnorm(5)
prob(item1, theta_n)
prob(item1, theta_n, derivative = 1)
item4 <- generate_item(model = "GRM", n_categories = 5)
prob(item4, theta)
# Partial Credit Model
theta <- rnorm(1)
item1 <- generate_item(model = "PCM")
# Probability of correct response
prob(item1, theta)
# First derivative of probability of correct response:
prob(item1, theta, derivative = 1)
# Second derivative of probability of correct response:
prob(item1, theta, derivative = 2)
# Multiple theta values
theta_n <- rnorm(5)
prob(item1, theta_n)
prob(item1, theta_n, derivative = 1)
prob(item1, theta_n, derivative = 2)
item3 <- generate_item(model = "GPCM2", n_categories = 3)
prob(item3, theta)
theta <- rnorm(1)
item1 <- generate_item(model = "GPCM")
# Probability of correct response
prob(item1, theta)
# First derivative of probability of correct response:
prob(item1, theta, derivative = 1)
# Second derivative of probability of correct response:
prob(item1, theta, derivative = 2)
# Multiple theta values
theta_n <- rnorm(5)
prob(item1, theta_n)
prob(item1, theta_n, derivative = 1)
prob(item1, theta_n, derivative = 2)
# Probability of each response category for Generalized Partial Credit Model
item2 <- generate_item(model = "GPCM", n_categories = 4)
prob(item2, theta)
# First derivative of each response category
prob(item2, theta, derivative = 1)
# Second derivative of each response category
prob(item2, theta, derivative = 2)
theta <- rnorm(1)
item1 <- generate_item(model = "GPCM2")
# Probability of correct response
prob(item1, theta)
# First derivative of probability of correct response:
prob(item1, theta, derivative = 1)
# Second derivative of probability of correct response:
prob(item1, theta, derivative = 2)
# Multiple theta values
theta_n <- rnorm(5)
prob(item1, theta_n)
prob(item1, theta_n, derivative = 1)
prob(item1, theta_n, derivative = 2)
theta <- rnorm(1)
ip <- generate_ip(model = "3PL")
# Probability of correct response
prob(ip, theta)
# First derivative of probability of correct response:
prob(ip, theta, derivative = 1)
# Second derivative of probability of correct response:
prob(ip, theta, derivative = 2)
# Multiple theta
theta_n <- rnorm(3)
prob(ip, theta_n)
prob(ip, theta_n, derivative = 1)
prob(ip, theta_n, derivative = 2)
# Extract probabilities of correct response (i.e. response is "1")
sapply(prob(ip, theta_n), `[`, TRUE, "1")
# Probabilities of incorrect response
sapply(prob(ip, theta_n), `[`, TRUE, "0")
# Probability of each response category for Generalized Partial Credit Model
ip <- generate_ip(model = "GPCM", n = 4, n_categories = c(3, 4, 6, 5))
prob(ip, theta)
# First derivative of each response category
prob(ip, theta, derivative = 1)
# Second derivative of each response category
prob(ip, theta, derivative = 2)
# Probability of a mixture of items models
ip <- generate_ip(model = c("GPCM", "2PL", "3PL", "GPCM"),
n_categories = c(4, 2, 2, 3))
prob(ip, theta)
# Multiple theta
prob(ip, theta_n)
# Extract probabilities of score "2" for each theta value
sapply(prob(ip, theta_n), `[`, TRUE, "2")
theta <- rnorm(1)
t1 <- generate_testlet(model_items = "3PL")
# Probability of correct response
prob(t1, theta)
# First derivative of probability of correct response:
prob(t1, theta, derivative = 1)
# Second derivative of probability of correct response:
prob(t1, theta, derivative = 2)
[Package irt version 0.2.9 Index]