Learn R Programming

TestDesign (version 1.2.4)

plot: Extension of plot() for objects in TestDesign package

Description

Extension of plot() for objects in TestDesign package

Usage

# S4 method for item_pool
plot(
  x,
  y,
  type = "info",
  theta = seq(-3, 3, 0.1),
  info_type = "FISHER",
  plot_sum = TRUE,
  select = NULL,
  examinee_id = 1,
  position = NULL,
  theta_range = c(-5, 5),
  ylim = NULL,
  color = "blue",
  z_ci = 1.96,
  simple = TRUE,
  theta_segment = "Estimated",
  color_final = "blue",
  ...
)

# S4 method for output_Static plot( x, y, type = NULL, theta = seq(-3, 3, 0.1), info_type = "FISHER", plot_sum = TRUE, select = NULL, examinee_id = 1, position = NULL, theta_range = c(-5, 5), ylim = NULL, color = "blue", z_ci = 1.96, simple = TRUE, theta_segment = "Estimated", color_final = "blue", ... )

# S4 method for constraints plot( x, y, type = "info", theta = seq(-3, 3, 0.1), info_type = "FISHER", plot_sum = TRUE, select = NULL, examinee_id = 1, position = NULL, theta_range = c(-5, 5), ylim = NULL, color = "blue", z_ci = 1.96, simple = TRUE, theta_segment = "Estimated", color_final = "blue", ... )

# S4 method for output_Shadow plot( x, y, type = "audit", theta = seq(-3, 3, 0.1), info_type = "FISHER", plot_sum = TRUE, select = NULL, examinee_id = 1, theta_range = c(-5, 5), ylim = NULL, color = "blue", z_ci = 1.96, simple = FALSE, theta_segment = "Estimated", color_final = "blue", ... )

# S4 method for output_Shadow_all plot( x, y, type = "audit", theta = seq(-3, 3, 0.1), info_type = "FISHER", plot_sum = TRUE, select = NULL, examinee_id = 1, position = NULL, theta_range = c(-5, 5), ylim = NULL, color = "blue", z_ci = 1.96, simple = FALSE, theta_segment = "Estimated", color_final = "blue", ... )

Arguments

x

accepts the following signatures:

  • '>item_pool: plot information and expected scores.

  • '>constraints: plot information range based on the test length constraint.

  • '>output_Static: plot information and expected scores based on the fixed assembly solution.

  • '>output_Shadow_all: plot audit trail, shadow test chart, and exposure rates from the adaptive assembly solution.

  • '>output_Shadow: plot audit trail and shadow test chart from the adaptive assembly solution.

y

not used, exists for compatibility with plot in the base R package.

type

the type of plot.

  • info plots information from '>item_pool, '>output_Static, and '>output_Shadow_all.

  • score plots expected scores from '>item_pool and '>output_Static.

  • audit plots audit trail from '>output_Shadow_all and '>output_Shadow.

  • shadow plots shadow test chart from '>output_Shadow_all and '>output_Shadow.

  • exposure plots exposure rates from '>output_Shadow_all.

theta

the theta grid to use in plotting. (default = seq(-3, 3, .1))

info_type

the type of information. Currently accepts FISHER. (default = FISHER)

plot_sum

used in '>item_pool objects.

  • if TRUE then plot pool-level values.

  • if FALSE then plot item-level values, and repeat for all items in the pool.

  • (default = TRUE)

select

used in '>item_pool objects. Item indices to subset.

examinee_id

used in '>output_Shadow and '>output_Shadow_all with type = 'audit' and type = 'shadow'. The examinee numeric ID to draw the plot.

position

used in '>output_Shadow_all with type = 'info'. The item position to draw the plot.

theta_range

used in '>output_Shadow and '>output_Shadow_all with type = 'audit'. The theta range to plot. (default = c(-5, 5))

ylim

(optional) the y-axis plot range. Used in most plot types.

color

the color of the curve.

z_ci

used in '>output_Shadow and '>output_Shadow_all with type = 'audit'. The range to use for confidence intervals. (default = 1.96)

simple

used in '>output_Shadow and '>output_Shadow_all with type = 'shadow'. If TRUE, simplify the chart by hiding unused items.

theta_segment

used in '>output_Shadow_all with type = 'exposure'. The type of theta to determine exposure segments. Accepts Estimated or True. (default = Estimated)

color_final

used in '>output_Shadow_all with type = 'exposure'. The color of item-wise exposure rates, only counting the items administered in the final theta segment as exposed.

...

arguments to pass onto plot.

Details

The base plot() does not allow directly storing the plot as a object. TestDesign::plot() calls recordPlot() internally to allow this. This adds convenience, but also introduces a caveat when using with the 'knitr' package. The caveat is that using plot() alone will not render the plot. This issue can be resolved by using p <- plot() and print(p) in two separate blocks in the markdown document.

Examples

Run this code
# NOT RUN {
subitempool <- itempool_science[1:8]

## Plot item information of a pool
plot(subitempool)
plot(itempool_science, select = 1:8)

## Plot expected score of a pool
plot(subitempool, type = "score")
plot(itempool_science, type = "score", select = 1:8)

## Plot assembly results from Static()
cfg <- createStaticTestConfig()
solution <- Static(cfg, constraints_science)
plot(solution)                 # defaults to the objective type
plot(solution, type = "score") # plot expected scores

## Plot attainable information range from constraints
plot(constraints_science)

## Plot assembly results from Shadow()
cfg <- createShadowTestConfig()
set.seed(1)
solution <- Shadow(cfg, constraints_science, true_theta = rnorm(1))
plot(solution, type = 'audit' , examinee_id = 1)
plot(solution, type = 'shadow', examinee_id = 1, simple = TRUE)

## plot(solution, type = 'exposure')

# }

Run the code above in your browser using DataLab