plot_info: Plot Item Information Function

View source: R/plot_info.R

plot_infoR Documentation

Plot Item Information Function

Description

plot_info Plots the item information function.

Usage

plot_info(
  ip,
  tif = FALSE,
  theta_range = c(-5, 5),
  focus_item = NULL,
  title = "",
  suppress_plot = FALSE,
  base_r_graph = FALSE,
  separate_testlet = TRUE,
  ...
)

Arguments

ip

An Item-class or Itempool-class object.

tif

If TRUE a test information plot will be plotted. The default value is FALSE.

theta_range

Either (a) a numeric vector of length two where the values are minimum and maximum theta values, or, (b) a numeric vector of length more than two where values represents the theta values that will be plotted.

focus_item

If one or more items information graphs needed to be focused whereas rest of the items' information functions needed to be on the background, provide item numbers or item ID's to be focused.

title

Title of the plot. If the value is NULL, the plot title will be suppressed.

suppress_plot

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

base_r_graph

If TRUE function will plot graphs using base R graphics. If FALSE the function will check whether 'ggplot2' package is installed. If it is installed, it will use 'ggplot2' package for the plot. The default value is FALSE.

separate_testlet

A logical value indicating whether to separate items within testlets or not. If TRUE, information values of all items within the testlet are plotted separately. if FALSE, information functions of items within testlets are combined (like test information function) and plotted that way along with standalone items.

...

Extra parameters that will pass to geom_line.

Value

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

Author(s)

Emre Gonulates

Examples

# Plot the information function of an item
plot_info(item(b = 1))

# Plot information function(s) of an Itempool object
n <- sample(10:20,1)
ip <- generate_ip()
plot_info(ip)
plot_info(ip, tif = TRUE)
plot_info(ip, tif = TRUE, theta_range = c(-3, 3))
# Focus on one item
plot_info(ip, focus_item = "Item_2")

# Base R Graphics
plot_info(ip, base_r_graph = TRUE)
plot_info(ip, focus_item = "Item_2", base_r_graph = TRUE)

# Plot information with focus on a specific item(s)
plot_info(ip, focus_item = "Item_1")
plot_info(ip, focus_item = 3)
# plot_info(ip, focus_item = c(2, 8))
# plot_info(ip, focus_item = c("Item_5", "Item_6"))

plot_info(ip, focus_item = 7, alpha = .7, color = "gray")

plot_info(ip, focus_item = "Item_3", color = "green", base_r_graph = TRUE)


# Information Plots with Testlets
ip <- c(testlet(itempool(b = c(-1, 1), item_id = c("t1-i1", "t1-i2"),
                         D = 1.702), testlet_id = "t1"),
        testlet(itempool(b = c(-2, 0, 2),
                         item_id = c("t2-i1", "t2-i2", "t2-i3"),
                         D = 1.702), testlet_id = "t2"),
        item(b = -1.5, item_id = "i1", D = 1.702),
        item(b = 0.25, item_id = "i2", D = 1.702),
        item(b = 1.5, item_id = "i3", D = 1.702))
plot_info(ip)
plot_info(ip, separate_testlet = FALSE)

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