Learn R Programming

irt (version 0.1.1)

plot_distractor_icc: Plot Empirical Item or Test characteristic curve

Description

plot_empirical_icc plots empirical item or test characteristic curve.

Usage

plot_distractor_icc(
  raw_resp,
  item,
  key,
  bins = 10,
  ip = NULL,
  theta = NULL,
  x_axis_scale = NULL,
  title = "",
  n_dodge = 1,
  suppress_plot = FALSE,
  ...
)

Arguments

raw_resp

Raw response matrix.

item

The column number, column name or the 'id' of the the item that should be plotted.

key

A vector of answer key.

bins

An integer larger than 2 representing of ability groups examinees should be grouped into. The default is 10. The maximum value of bins + 1 is the number of possible total scores.

ip

An Itempool-class object that is needed for some plots. If ip provided and theta is not provided, then ability will be estimated using EAP method with prior mean 0 and prior standard deviation of 1. This is a slower method depending on the size of the data.

theta

A vector of examinee abilities. If theta values provided the bins are formed using them instead of sum scores.

x_axis_scale

Set the scale of the x-axis. The default value is NULL. For if sum score is used scale will be defaulted to "percent", Otherwise if valid theta or ip arguments provided the scale defaults to "theta".

"percent"

Percent interval.

"number"

Numbers between 1 and bins.

"theta"

Theta values equally divided into bins. the middle value of the bin is shown in the x-axis. For example, if bins = 10, the first tick of the x-axis will be the mean of minimum theta value and 10th percentile theta value.

title

Title of the plot

n_dodge

The number of lines the x-axis tick labels should be written to. This is especially useful if the x-axis tick labels overlap with each other. The default value is 1, which means all of the labels are written on the same line.

suppress_plot

If FALSE the function will print the plot. If TRUE, function will return the plot object. Default value is FALSE.

...

Extra parameters that will pass to geom_line.

Value

Depending on the value of suppress_plot function either prints the proportion of examinees in each bin respond to each distractor or returns the plot object.

Examples

Run this code
# NOT RUN {
n_item <- 10 # sample(8:12, 1)
n_theta <- 10000 # sample(100:200, 1)
raw_resp <- matrix(sample(LETTERS[1:4], n_item * n_theta, replace = TRUE),
                   nrow = n_theta, ncol = n_item,
                   dimnames = list(paste0("Examinee-", 1:n_theta),
                                   paste0("Item-", 1:n_item)))
key <- sample(LETTERS[1:4], n_item, replace = TRUE)
plot_distractor_icc(raw_resp, 3, key)
# Change the number of bins
plot_distractor_icc(raw_resp, 3, key, bins = 15)

# }

Run the code above in your browser using DataLab