plot.Itempool: Plot Item Characteristic Curves or Test Characteristic Curve...

Description Usage Arguments Value Author(s) Examples

View source: R/plot_itempool.R

Description

plot.Itempool plots the item characteristic curves (item response curves) or test characteristic curve of an Itempool-class object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## S3 method for class 'Itempool'
plot(
  x,
  theta_range = c(-4, 4),
  type = "icc",
  tcc_prop_corr = FALSE,
  focus_item = NULL,
  title = "",
  suppress_plot = FALSE,
  legend_title = NULL,
  base_r_graph = FALSE,
  ...
)

Arguments

x

An Itempool-class object.

theta_range

Either a numeric vector of length two setting the boundaries of x-axis, e.g. c(-4, 4), or, a numeric vector that is includes the theta values that will be plotted, e.g. seq(-3, 3, by = 0.1).

type

The type of the graph. The default value is "icc". Available options are:

"icc"

Plot item characteristic curve of each item

"tcc"

Plot test characteristic curve

"hist"

Plot histograms of item parameters

"pars"

Plot dot plot of item parameters

tcc_prop_corr

If TRUE, test characteristic curve will be show the proportion correct of the test (i.e. the range of y-axis will be 0-1 instead of 0 to the number of items).

focus_item

A character string of the 'item_id' of the item to be focused. If type = "pars", this item will be shown with a red dot to distinguish it from others.

title

Title of the plot. Default is NULL. If tcc is TRUE it will be 'Test Characteristic Curve', if FALSE it will be 'Item Characteristic Curve'.

suppress_plot

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

legend_title

The title of the plot's legend.

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.

...

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.

Author(s)

Emre Gonulates

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
ip <- generate_ip(n = sample(10:15,1))
plot(ip)

# Additional arguments will passed to geom_line
plot(ip, size = .25, alpha = 0.3)

# Set the boundaries of the graph
plot(ip, theta_range = c(-2, 2))
# alternatively provide theta values
plot(ip, theta_range = seq(-6, 6, by = 0.25))


# Test Characteristic Curve
plot(ip, type = "tcc")

# Proportion correct for test characteristic curve
plot(ip, type = "tcc", tcc_prop_corr = TRUE)

# Plot histogram of item parameters
plot(ip, type = "hist")


## Not run: 
# Item parameter summary
ip <- generate_ip(n = 200)
plot(ip, type = "pars")
plot(ip, type = "pars", dotsize = .75)
plot(ip, type = "pars", focus_item = "Item_22")
# Use base R graphics
plot(ip, type = "pars", base_r_graph = TRUE)

# # Remove the legend altogether
# plot(ip, suppress_plot = TRUE) + ggplot2::theme(legend.position="none")
# # Change the labels:
# plot(ip, suppress_plot = TRUE) +
#   ylab("Probability") + xlab("Ability Score")

## End(Not run)

irt documentation built on Nov. 9, 2021, 9:07 a.m.