# NOT RUN {
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)
# 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)
# Expected score for a subject with a given theta value
prob(item2, theta, expected_value = TRUE)
# Multiple theta values
theta_n <- rnorm(5)
prob(item1, theta_n)
prob(item1, theta_n, derivative = 1)
prob(item1, theta_n, derivative = 2)
prob(item2, theta_n)
prob(item2, theta_n, derivative = 1)
prob(item2, 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(5)
prob(ip, theta_n)
prob(ip, theta_n, derivative = 1)
prob(ip, theta_n, derivative = 2)
# 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)
# Expected score for a subject with a given theta value for each item
prob(ip, theta, expected_value = TRUE)
# 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)
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)
# }
Run the code above in your browser using DataLab