Learn R Programming

irt (version 0.1.1)

plot.Item: Plot Item Characteristic Curve of an Item object

Description

plot.Item Plots the item characteristic curve.

Usage

# S3 method for Item
plot(
  x,
  theta_range = c(-4, 4),
  title = "",
  suppress_plot = FALSE,
  category_names = FALSE,
  legend_title = NULL,
  ...
)

Arguments

x

An Item-class object.

theta_range

The boundaries of x axis.

title

Title of the plot. By default if the item is 1-4PM IRT model then the title will be "Item Characteristic Curve" if the item follows Graded Response Model the title will be "Category Response Functions". Set it NULL to remove it.

suppress_plot

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

category_names

If the model used is 'GRM' (Graded Response Model) these names will serve as category names. For example, c("Strongly Disagree", "Disagree", "Agree", "Strongly Agree"). The default is FALSE where the default category scores will be printed. If the value is NULL no legend will be printed but the categories will be printed differently.

legend_title

The title of the plot's legend.

...

Additional arguments that will be passed to geom_line

Value

Depending on the value of suppress_plot function either prints the item characteristic curve or returns the plot object.

Examples

Run this code
# NOT RUN {
plot(x = item(b = 0.3, D = 1))

item <- item(a = 1.2, b = 0.3, c = .2)
plot(item)
plot(item(a = 1.2, b = 0.3, c = .2, d = .89, D = 1))

# Plot Graded Response Model
ip <- item(a = 0.902, b = c(-1.411, 0.385, 1.79), model = "GRM")
plot(ip)
plot(ip, category_names = c("Strongly Disagree", "Disagree", "Agree",
                            "Strongly Agree"))
ip <- item(a = 0.8, b = 1, model = "GRM")
plot(ip, category_names = c("Incorrect", "Correct"), legend_title = "Response")

# # Change the y-axis label
# plot(ip, suppress_plot = TRUE) + ylab("New Label")

# }

Run the code above in your browser using DataLab