plot.wmat: Method to plot worth or model parameters from LLBT or pattern...

View source: R/plot.wmat.R

plot.wmatR Documentation

Method to plot worth or model parameters from LLBT or pattern models

Description

A plot of the worth or model parameter matrix obtained from the fit of an LLBT or pattern model is produced. This matrix is obtained from llbt.worth or patt.worth and is an object of class wmat.

Usage

## S3 method for class 'wmat'
plot(x, main = "Preferences", ylab = "Estimate", psymb = NULL,
        pcol = NULL, ylim = range(worthmat), log = "", ...)

Arguments

x

worth or parameter matrix as generated from llbt.worth or patt.worth.

main

main title of the plot.

ylab

y-axis label

psymb

plotsymbols for objects, see Details below

pcol

colours for objects, see Details below

ylim

limits for y-axis

log

if specified as log = "y", the y-axis is to be logarithmic

...

further graphical parameters, use e.g. lty = "dashed" to obtain dashed lines connecting the objects

Details

Plotsymbols can be defined as an integer vector of length equal to the number of objects, e.g., psymb = c(15, 22, 18). They specify the graphical option pch as used in the points function. The default (psymb = NULL) uses the symbols 15 through 18 and 21 through 25. The number of symbols is determined from the number of rows in worthmat. A display of some plotsymbols may be obtained from the corresponding example below.

If pcol = NULL, the colours for objects are defined from the rainbow_hcl palette using the colorspace package. Other specifications include "heat", "terrain" (see rainbow_hcl), and "gray" (see grDevices). The number of different colours is automatically determined via the number of objects. Alternatively, pcol can be specified as a character vector containing user defined RGB colour values for all objects (as hexadecimal strings in the form "#rrggbb"), e.g., for blue "#0000FF"). These are usually set up using standard colour palettes (see rainbow or, e.g., the RColorBrewer package (see Examples below).

The old plot function, plotworth(), is defunct (see prefmod-defunct) and will generate errors. If you are still using it, please update your code!

Author(s)

Reinhold Hatzinger

See Also

patt.worth

Examples

# fit only first three objects with SEX effect
m2 <- pattPC.fit(cemspc, nitems = 3, formel = ~SEX, elim = ~SEX, undec = TRUE)

# calculate and plot worth parameters
m2worth <- patt.worth(m2)
plot(m2worth)
plot(m2worth, pcol = "terrain")

# display of some plotsymbols (pch)
plot(0:25, rep(1, 26), pch = 0:25, cex = 1.5)
text(0:25, rep(0.95, 26), 0:25)

# usage of the "RColorBrewer" package
## Not run: 
library("RColorBrewer")
mypalette <- brewer.pal(3, "Set1")
plot(m2worth, pcol = mypalette)
## End(Not run)

prefmod documentation built on June 11, 2022, 3 p.m.