plot.freqtab: Plotting Frequency Distributions

View source: R/plot.freqtab.R

plot.freqtabR Documentation

Plotting Frequency Distributions

Description

This function plots univariate and bivariate frequency tables of class “freqtab”.

Usage

## S3 method for class 'freqtab'
plot(
  x,
  y = NULL,
  xcol = 1,
  ycol,
  pch = 16,
  ylty = 1,
  xlab = names(dimnames(x))[1],
  addlegend = !missing(y),
  legendtext,
  ...
)

## S3 method for class 'freqtab'
points(x, xcol = 1, pch = 16, ds = 50, dm = 100, ...)

Arguments

x

univariate or bivariate score distribution of class “freqtab”.

y

either an object of class “freqtab”, where frequencies will be extracted, or a vector or matrix of frequencies, to be added to the plot of x. See below for details.

xcol, ycol

colors used in plotting x and y.

pch

plotting symbol used to plot bivariate points.

ylty

line type used to plot frequencies in y.

xlab

label for the x axis.

addlegend

logical indicating whether or not a legend should be added.

legendtext

character vector of text to be passed to the legend argument of the legend function, defaulting to column names used in y.

...

further arguments passed to or from other methods, such as graphical parameters besides col, type, and pch.

ds, dm

integers for the scaling and center of the RGB density values, with defaults of 50 and 100. These are used to convert the observed counts in x to the [0, 255] range of RGB values.

Details

For the points method, a scatterplot for x is added to the current opened plot.

For the plot method, when x is univariate, i.e, having 2 columns, a frequency plot is created for x. When x is bivariate, e.g., coming from a single group equating design or one form of a nonequivalent groups design, a scatterplot is produced with frequency plots for the marginal distributions.

y is used to superimpose lines, e.g., smoothed frequencies, over the (marginal) frequencies of x.

Colors must be specified using xcol and ycol. When ycol is missing, a vector of colors is created using rainbow(ncol(y)).

Value

The univariate option produces a single line plot of type = "h". Frequencies from y are then superimposed. The bivariate option produces a scatterplot with a marginal frequency plot for each distribution.

Author(s)

Anthony Albano tony.d.albano@gmail.com

See Also

plot.table, plot.equate, lines, points

Examples


x <- freqtab(KBneat$x, scales = list(0:36, 0:12))
plot(x)

xs <- loglinear(x, degrees = c(4, 1),
  stepup = TRUE, showWarnings = FALSE)
plot(x, xs, lwd = 2)


equate documentation built on June 7, 2022, 5:10 p.m.