ks: Item Characteristic Curve Estimation using Kernel Smoothing

View source: R/kernel_smoothing.R

ksR Documentation

Item Characteristic Curve Estimation using Kernel Smoothing

Description

Item Characteristic Curve Estimation using Kernel Smoothing

Usage

ks(
  resp,
  h = NULL,
  kernel_func = "gauss",
  criterion = NULL,
  points = seq(-3, 3, 0.05)
)

Arguments

resp

A response matrix where each row is the responses of an examinee and each column represents an item.

resp does not necessarily be a matrix. It can be data.frame or any other object that can be convertible to matrix using as.matrix function.

resp can contain missing responses.

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 criterion and Gaussian kernel smoothing function, h = 0.2 is recommended for large sample sizes (like 3000), h = 0.3 is recommended for medium sample sizes (like 500), and h = 0.4 is recommended for small sample sizes (like 100), and

The default value is 1.06 σ(criterion) n_{examinees}^{-1/5}.

kernel_func

Choice of kernel function. Possible choices are:

  • "gauss"Gaussian kernel. f(x) = e^{-u^2/2}.

  • "unif"Uniform kernel. f(x) = 0.5, |u| < 0.5, else 0.

  • "quadratic"Quadratic kernel. f(x) = 0.75(1-u^2), |u| < 1, else 0.

  • Custom FunctionYou can provide a custom kernel function object. The function should be maximum at u = 0 and gets closer to 0 on either side.

The default value is "gauss", i.e. Gaussian kernel function.

criterion

The ability estimates for each examinee. The default is NULL where the abilities will be estimated from the sum scores. First sum scores will be calculated, then the rank of each examinee's sum score will be calculated. These ranks will be divided by the number of examinees plus 1 in order to get values between 0 and 1. Finally, these values will be put on standard normal scale (by inverse CDF).

points

The points at which the item characteristic curve will be calculated. The default value is points = seq(-3, 3, 0.05).

Value

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.

Author(s)

Emre Gonulates

Examples

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)


irt documentation built on Nov. 10, 2022, 5:50 p.m.