1\name{plotrcim0}
2\alias{plotrcim0}
3%- Also NEED an '\alias' for EACH other topic documented here.
4\title{ Main Effects Plot for a Row-Column Interaction Model (RCIM)
5
6}
7\description{
8  Produces a main effects plot for Row-Column Interaction
9  Models (RCIMs).
10
11}
12\usage{
13  plotrcim0(object, centered = TRUE, which.plots = c(1, 2),
14            hline0 = TRUE, hlty = "dashed", hcol = par()$col, hlwd = par()$lwd,
15            rfirst = 1, cfirst = 1,
16            rtype = "h", ctype = "h",
17            rcex.lab = 1, rcex.axis = 1, rtick = FALSE,
18            ccex.lab = 1, ccex.axis = 1, ctick = FALSE,
19            rmain = "Row effects", rsub = "",
20            rxlab = "", rylab = "Row effects",
21            cmain = "Column effects", csub = "",
22            cxlab= "", cylab = "Column effects",
23            rcol = par()$col, ccol = par()$col,
24            no.warning = FALSE, ...)
25
26}
27\arguments{
28\item{object}{
29  An \code{\link{rcim}} object.
30  This should be of rank-0, i.e., main effects only and no
31  interactions.
32
33
34}
35\item{which.plots}{
36  Numeric, describing which plots are to be plotted.
37  The row effects plot is 1 and the column effects plot is 2.
38  Set the value \code{0}, say, for no plots at all.
39
40
41}
42\item{centered}{
43  Logical.
44  If \code{TRUE} then the row and column effects are centered
45  (but not scaled) by \code{\link[base]{scale}}.
46  If \code{FALSE} then the raw effects are used (of which
47  the first are zero by definition).
48
49
50}
51\item{hline0, hlty, hcol, hlwd}{
52  \code{hline0} is logical. If \code{TRUE} then a horizontal line is
53  plotted at 0 and the other arguments describe this line.
54  Probably having \code{hline0 = TRUE} only makes sense when
55  \code{centered = TRUE}.
56
57
58}
59\item{rfirst, cfirst}{
60  \code{rfirst} is the level of row that is placed first in the
61  row effects plot, etc.
62
63
64}
65\item{rmain, cmain}{
66  Character.
67  \code{rmain} is the main label in the row effects plot, etc.
68
69
70}
71\item{rtype, ctype, rsub, csub}{
72  See the \code{type} and \code{sub} arguments of
73  \code{\link[graphics]{plot.default}}.
74
75
76
77% 20201020; trying \code{\link[graphics]{plot.default}}.
78
79
80% 20200427; all \code{\link[graphics:plot]{plot}} changed to
81% \code{\link[base:plot]{plot}}, because  of R.4.0.0.
82
83
84
85
86}
87%\item{rlabels, clabels}{
88% rlabels = FALSE, clabels = FALSE,
89%  Currently not functioning properly.
90%  zz.
91%  See \code{labels} argument of
92%  \code{\link[base:plot]{plot}}.
93%
94%}
95\item{rxlab, rylab, cxlab, cylab}{
96  Character.
97  For the row effects plot,
98  \code{rxlab} is \code{xlab} and
99  \code{rylab} is \code{ylab};
100  see \code{\link[graphics:par]{par}}.
101  Ditto for \code{cxlab} and \code{cylab} for the column effects plot.
102
103
104}
105\item{rcex.lab, ccex.lab}{
106  Numeric.
107  \code{rcex.lab} is \code{cex} for the row effects plot label,
108  etc.
109
110
111}
112\item{rcex.axis, ccex.axis}{
113  Numeric.
114  \code{rcex.axis} is the \code{cex} argument for the row effects axis label,
115  etc.
116
117
118}
119
120\item{rtick, ctick}{
121  Logical.
122  If \code{rtick = TRUE} then add ticks to the row effects plot, etc.
123
124
125}
126\item{rcol, ccol}{
127  \code{rcol} give a colour for the row effects plot,
128  etc.
129
130
131}
132\item{no.warning}{
133  Logical. If \code{TRUE} then no warning is issued if the
134  model is not rank-0.
135
136
137}
138%\item{llwd}{
139%  Fed into \code{lwd} of \code{\link[graphics:par]{par}}.
140%
141%}
142%\item{rlas, clas}{
143%  Fed into \code{las} of \code{\link[graphics:par]{par}}.
144%
145%}
146%\item{main}{
147%  Character. A common title.
148%
149%}
150%\item{type}{
151%  Fed into \code{type} of \code{\link[base:plot]{plot}}.
152%
153%}
154\item{...}{
155  Arguments fed into
156  \code{\link[graphics]{plot.default}}, etc.
157
158
159
160% 20201026: was
161% Arguments fed into both \code{\link[base:plot]{plot}} calls.
162
163
164
165
166}
167
168}
169\details{
170  This function plots the row and column effects of a rank-0 RCIM.
171  As the result is a main effects plot of a regression analysis, its
172  interpretation when \code{centered = FALSE} is relative
173  to the baseline (reference level) of a row and column, and
174  should also be considered in light of the link function used.
175  Many arguments that start with \code{"r"} refer to the row
176  effects plot, and \code{"c"} for the column
177  effects plot.
178
179
180}
181\value{
182  The original object with the \code{post} slot
183  assigned additional information from the plot.
184
185
186}
187
188
189
190\note{
191  This function should be only used to plot the object of rank-0 RCIM.
192  If the rank is positive then it will issue a warning.
193
194
195  Using an argument \code{ylim} will mean the row and column
196  effects are plotted on a common scale;
197  see \code{\link[graphics]{plot.window}}.
198
199
200% This function is not finished yet.
201% There may be several bugs!
202
203}
204
205
206\author{
207  T. W. Yee,
208  A. F. Hadi.
209
210}
211
212%\section{Warning}{
213%
214%}
215
216
217\seealso{
218  \code{\link{moffset}}
219  \code{\link{Rcim}},
220  \code{\link{rcim}}.
221
222
223
224}
225\examples{
226alcoff.e <- moffset(alcoff, "6", "Mon", postfix = "*")  # Effective day
227fit0 <- rcim(alcoff.e, family = poissonff)
228\dontrun{par(oma = c(0, 0, 4, 0), mfrow = 1:2)  # For all plots below too
229ii <- plot(fit0, rcol = "blue", ccol = "orange",
230           lwd = 4, ylim = c(-2, 2),  # A common ylim
231           cylab = "Effective daily effects", rylab = "Hourly effects",
232           rxlab = "Hour", cxlab = "Effective day")
233ii@post  # Endowed with additional information
234}
235
236# Negative binomial example
237\dontrun{
238fit1 <- rcim(alcoff.e, negbinomial, trace = TRUE)
239plot(fit1, ylim = c(-2, 2)) }
240
241# Univariate normal example
242fit2 <- rcim(alcoff.e, uninormal, trace = TRUE)
243\dontrun{ plot(fit2, ylim = c(-200, 400)) }
244
245# Median-polish example
246\dontrun{
247fit3 <- rcim(alcoff.e, alaplace1(tau = 0.5), maxit = 1000, trace = FALSE)
248plot(fit3, ylim = c(-200, 250)) }
249
250# Zero-inflated Poisson example on "crashp" (no 0s in alcoff)
251\dontrun{
252cbind(rowSums(crashp))  # Easy to see the data
253cbind(colSums(crashp))  # Easy to see the data
254fit4 <- rcim(Rcim(crashp, rbaseline = "5", cbaseline = "Sun"),
255             zipoissonff, trace = TRUE)
256plot(fit4, ylim = c(-3, 3)) }
257}
258