View source: R/kernel_smoothing.R
| ks | R Documentation |
Item Characteristic Curve Estimation using Kernel Smoothing
ks(
resp,
h = NULL,
kernel_func = "gauss",
criterion = NULL,
points = seq(-3, 3, 0.05)
)
resp |
A response matrix where each row is the responses of an examinee and each column represents an item.
|
h |
The bandwidth parameter that controls the amount of smoothing.
A small value will decrease the bias whereas increase the sampling
variability. For a standard normally distributed The default value is |
kernel_func |
Choice of kernel function. Possible choices are:
The default value is |
criterion |
The ability estimates for each examinee. The default is
|
points |
The points at which the item characteristic curve will be
calculated. The default value is |
A list with following elements will be returned:
pointsThe quadrature points at which ICC is calculated.
iccA matrix where each cell represents probability of selecting a response (for dichotomous models, probability of correct response). Items are on columns and quadrature points are on rows.
seA matrix of standard errors of each point of
icc. This matrix has the same dimension as icc.
criterionThe criterion values used for examinees. If
criterion = NULL these numbers will be based on sum scores.
hThe bandwidth parameter.
Emre Gonulates
ip <- generate_ip(model = "3PL", n = 50)
true_theta <- rnorm(10000)
resp <- sim_resp(ip = ip, theta = true_theta, prop_missing = 0.3)
kern_output <- ks(resp)
# Plot ICC
i <- 12 # select an item to plot
x <- kern_output$icc[, i]
se <- kern_output$se[, i]
p <- prob(ip = ip[i], theta = kern_output$points)
p <- sapply(p, `[`, 2) # get the probability of correct responses
graph_data <- data.frame(
theta = kern_output$points,
icc = x,
ci_low = sapply(x - qnorm(.975) * se, function(x) max(x, 0)),
ci_high = sapply(x + qnorm(.975) * se, function(x) min(x, 1)),
p = p)
## Not run:
p <- ggplot(data = graph_data) +
geom_line(aes(x = theta, y = icc), color = "blue", alpha = .7, size = 1) +
geom_line(aes(x = theta, y = p), color = "red", size = 1, alpha = .7) +
geom_ribbon(data = graph_data,
aes(x = theta, ymin = ci_low, ymax = ci_high),
alpha = .25) +
ylim(0, 1) +
labs(x = "Theta", y = "Probability",
title = "Item Characteristic Curve") +
theme_bw()
p
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.