distractor_plot: Distractor plot

View source: R/plots.R

distractor_plotR Documentation

Distractor plot

Description

Produce a diagnostic distractor plot for an item

Usage

distractor_plot(
  dataSrc,
  item_id,
  predicate = NULL,
  legend = TRUE,
  curtains = 10,
  adjust = 1,
  col = NULL,
  ...
)

Arguments

dataSrc

a connection to a dexter database or a data.frame with columns: person_id, item_id, response, item_score and optionally booklet_id

item_id

The ID of the item to plot. A separate plot will be produced for each booklet that contains the item, or an error message if the item_id is not known. Each plot contains a non-parametric regression of each possible response on the total score.

predicate

An optional expression to subset data, if NULL all data is used

legend

logical, whether to include the legend. default is TRUE

curtains

100*the tail probability of the sum scores to be shaded. Default is 10. Set to 0 to have no curtains shown at all.

adjust

factor to adjust the smoothing bandwidth respective to the default value

col

vector of colors to use for plotting. The names of the vector can be responses. If the vector is not named, colors are assigned to the most frequent responses first.

...

further arguments to plot.

Details

Customization of title and subtitle can be done by using the arguments main and sub. These arguments can contain references to the variables item_id, booklet_id, item_position(if available), pvalue, rit and rir. References are made by prefixing these variables with a dollar sign. Variable names may be postfixed with a sprintf style format string, e.g. distractor_plot(db, main='item: $item_id', sub='Item rest correlation: $rir:.2f')

Value

Silently, a data.frame of response categories and colors used. Potentially useful if you want to customize the legend or print it separately


dexter documentation built on Sept. 11, 2024, 6:42 p.m.