plotrcim0: Main Effects Plot for a Row-Column Interaction Model (RCIM)

View source: R/family.rcim.R

plotrcim0R Documentation

Main Effects Plot for a Row-Column Interaction Model (RCIM)

Description

Produces a main effects plot for Row-Column Interaction Models (RCIMs).

Usage

  plotrcim0(object, centered = TRUE, which.plots = c(1, 2),
            hline0 = TRUE, hlty = "dashed", hcol = par()$col, hlwd = par()$lwd,
            rfirst = 1, cfirst = 1,
            rtype = "h", ctype = "h",
            rcex.lab = 1, rcex.axis = 1, rtick = FALSE,
            ccex.lab = 1, ccex.axis = 1, ctick = FALSE,
            rmain = "Row effects", rsub = "",
            rxlab = "", rylab = "Row effects",
            cmain = "Column effects", csub = "",
            cxlab= "", cylab = "Column effects",
            rcol = par()$col, ccol = par()$col,
            no.warning = FALSE, ...)

Arguments

object

An rcim object. This should be of rank-0, i.e., main effects only and no interactions.

which.plots

Numeric, describing which plots are to be plotted. The row effects plot is 1 and the column effects plot is 2. Set the value 0, say, for no plots at all.

centered

Logical. If TRUE then the row and column effects are centered (but not scaled) by scale. If FALSE then the raw effects are used (of which the first are zero by definition).

hline0, hlty, hcol, hlwd

hline0 is logical. If TRUE then a horizontal line is plotted at 0 and the other arguments describe this line. Probably having hline0 = TRUE only makes sense when centered = TRUE.

rfirst, cfirst

rfirst is the level of row that is placed first in the row effects plot, etc.

rmain, cmain

Character. rmain is the main label in the row effects plot, etc.

rtype, ctype, rsub, csub

See the type and sub arguments of plot.default.

rxlab, rylab, cxlab, cylab

Character. For the row effects plot, rxlab is xlab and rylab is ylab; see par. Ditto for cxlab and cylab for the column effects plot.

rcex.lab, ccex.lab

Numeric. rcex.lab is cex for the row effects plot label, etc.

rcex.axis, ccex.axis

Numeric. rcex.axis is the cex argument for the row effects axis label, etc.

rtick, ctick

Logical. If rtick = TRUE then add ticks to the row effects plot, etc.

rcol, ccol

rcol give a colour for the row effects plot, etc.

no.warning

Logical. If TRUE then no warning is issued if the model is not rank-0.

...

Arguments fed into plot.default, etc.

Details

This function plots the row and column effects of a rank-0 RCIM. As the result is a main effects plot of a regression analysis, its interpretation when centered = FALSE is relative to the baseline (reference level) of a row and column, and should also be considered in light of the link function used. Many arguments that start with "r" refer to the row effects plot, and "c" for the column effects plot.

Value

The original object with the post slot assigned additional information from the plot.

Note

This function should be only used to plot the object of rank-0 RCIM. If the rank is positive then it will issue a warning.

Using an argument ylim will mean the row and column effects are plotted on a common scale; see plot.window.

Author(s)

T. W. Yee, A. F. Hadi.

See Also

moffset Rcim, rcim.

Examples

alcoff.e <- moffset(alcoff, "6", "Mon", postfix = "*")  # Effective day
fit0 <- rcim(alcoff.e, family = poissonff)
## Not run: par(oma = c(0, 0, 4, 0), mfrow = 1:2)  # For all plots below too
ii <- plot(fit0, rcol = "blue", ccol = "orange",
           lwd = 4, ylim = c(-2, 2),  # A common ylim
           cylab = "Effective daily effects", rylab = "Hourly effects",
           rxlab = "Hour", cxlab = "Effective day")
ii@post  # Endowed with additional information

## End(Not run)

# Negative binomial example
## Not run: 
fit1 <- rcim(alcoff.e, negbinomial, trace = TRUE)
plot(fit1, ylim = c(-2, 2)) 
## End(Not run)

# Univariate normal example
fit2 <- rcim(alcoff.e, uninormal, trace = TRUE)
## Not run:  plot(fit2, ylim = c(-200, 400)) 

# Median-polish example
## Not run: 
fit3 <- rcim(alcoff.e, alaplace1(tau = 0.5), maxit = 1000, trace = FALSE)
plot(fit3, ylim = c(-200, 250)) 
## End(Not run)

# Zero-inflated Poisson example on "crashp" (no 0s in alcoff)
## Not run: 
cbind(rowSums(crashp))  # Easy to see the data
cbind(colSums(crashp))  # Easy to see the data
fit4 <- rcim(Rcim(crashp, rbaseline = "5", cbaseline = "Sun"),
             zipoissonff, trace = TRUE)
plot(fit4, ylim = c(-3, 3)) 
## End(Not run)

VGAM documentation built on Sept. 18, 2024, 9:09 a.m.