Skip to main content

Summarizing and Visualizing Item Response Data

Description

Summarizing and visualizing “itemresp” data objects.

Usage

  ## S3 method for class 'itemresp'
summary(object, items = NULL, abbreviate = FALSE,
    mscale = TRUE, simplify = TRUE, sep = " ", ...)
  ## S3 method for class 'itemresp'
plot(x, xlab = "", ylab = "", items = NULL,
    abbreviate = FALSE, mscale = TRUE, sep = "\n", off = 2, axes = TRUE,
    names = TRUE, srt = 45, adj = c(1.1, 1.1), ...)

Arguments

object, x an object of class “itemresp”.
items character or integer for subsetting the items to be summarized/visualized. By default, all items are used.
abbreviate logical or integer. Should scale labels be abbreviated? Alternatively, an integer with the desired abbreviation length. The default is some heuristic based on the length of the labels.
mscale logical. Should mscale values be used for printing/plotting? If FALSE, integers 0, 1, … are used.
simplify logical. Should the summary table be collapsed into a matrix or returned as a list?
sep character. A character for separating item labels from their corresponding scale labels (if any).
xlab, ylab, off, axes, … arguments passed to spineplot.
names logical or character. If TRUE, the names of the items are displayed on the x-axis. If FALSE, numbers of items are shown. Alternatively a character vector of the same length as the number of items can be supplied.
srt, adj numeric. Angle (srt) and adjustment (adj) in case names (rather than numbers) are used as x-axis labels. These are passed to text.

Details

The plot method essentially just calls summary (passing on most further arguments) and then visualizes the result as a spineplot.

See Also

itemresp, spineplot

Examples

library("psychotools")

## summary/visualization for verbal aggression data
data("VerbalAggression", package = "psychotools")
r <- itemresp(VerbalAggression$resp[, 1:6])
mscale(r) <- c("no", "perhaps", "yes")
summary(r)
             no perhaps yes
S1WantCurse  91      95 130
S1DoCurse    91     108 117
S1WantScold 126      86 104
S1DoScold   136      97  83
S1WantShout 154      99  63
S1DoShout   208      68  40
plot(r)

## modify formatting of mscale
summary(r, abbreviate = 1)
              n   p   y
S1WantCurse  91  95 130
S1DoCurse    91 108 117
S1WantScold 126  86 104
S1DoScold   136  97  83
S1WantShout 154  99  63
S1DoShout   208  68  40
summary(r, mscale = FALSE)
              0   1   2
S1WantCurse  91  95 130
S1DoCurse    91 108 117
S1WantScold 126  86 104
S1DoScold   136  97  83
S1WantShout 154  99  63
S1DoShout   208  68  40
## illustration for varying mscale across items
## merge with additional random binary response
b <- itemresp(rep(c(-1, 1), length.out = length(r)),
  mscale = c(-1, 1), labels = "Dummy")
rb <- merge(r[, 1:2], b)
head(rb, 2)
[1] {no,prh,-1} {no,no,1}  
## summary has NAs for non-existent response categories
summary(rb)
                               0   1   2
S1WantCurse (no,perhaps,yes)  91  95 130
S1DoCurse (no,perhaps,yes)    91 108 117
Dummy (-1,1)                 158 158  NA
summary(rb, mscale = FALSE)
              0   1   2
S1WantCurse  91  95 130
S1DoCurse    91 108 117
Dummy       158 158  NA
plot(rb, srt = 25)

plot(rb, mscale = FALSE)