visualizers {gammi} | R Documentation |
Internal Functions for Plot Method
Description
Internal functions used by the plot.gammi
function to visualize main effects and two-way interaction effects in fit gammi
objects.
Usage
visualizer1(x, y, bars = FALSE, bw = 0.02, lty = 1, lwd = 2, col = "black",
lwr = NULL, upr = NULL, ci.lty = 2, ci.lwd = 1.25, ci.col = "black",
zero = TRUE, zero.lty = 3, xlim = NULL, ylim = NULL,
xlab = NULL, ylab = NULL, main = NULL, ...)
visualizer2(x, y, z, col = NULL, ncolor = 21,
xlim = NULL, ylim = NULL, zlim = NULL, zline = 1.5,
xlab = NULL, ylab = NULL, zlab = NULL, main = NULL,
xticks = NULL, xlabels = NULL, yticks = NULL, ylabels = NULL, ...)
Arguments
x , y , z |
For 1D plots: |
bars |
For 1D plots: logical indicating whether to create a line plot (default) or a bar plot ( |
bw |
For 1D plots: width of the bars relative to range of |
lty , lwd |
For 1D plots: line type and width for 1D plots. |
col |
For 1D plots: single color for line/bar plot. For 2D plots: vector of colors for image plot. |
ncolor |
For 2D plots: number of colors used for image plot and color legend, see Note. |
lwr , upr |
For 1D plots: number vectors defining the lower and upper bounds to plot for a confidence interval. Must be the same length as |
ci.lty , ci.lwd , ci.col |
For 1D plots: the type, width, and color for the confidence interval lines drawn from the |
zero , zero.lty |
For 1D plots: |
xlim , ylim , zlim |
For 1D plots: |
xlab , ylab , zlab |
For 1D plots: |
main |
Title of the plot. |
zline |
For 2D plots: margin line for the z-axis label. |
xticks , yticks |
For 2D plots: tick marks for x-axis and y-axis grid lines. |
xlabels , ylabels |
For 2D plots: labels corresponding to the input tick marks that define the grid lines. |
... |
Additional arguments passed to the |
Details
The visualizer1
function is used to plot 1D (line/bar) plots, and the visaulizer2
function is used to plot 2D (image) plots. These functions are not intended to be called by the user, but they may be useful for producing customized visualizations that are beyond the scope of the plot.gammi
function.
Value
A plot is produced and nothing is returned.
Note
The vector of colors used to construct the plots is defined as colorRampPalette(col)(ncolor)
, which interpolates a color palette of length ncolor
from the input colors in the vector col
.
Author(s)
Nathaniel E. Helwig <helwig@umn.edu>
References
Helwig, N. E. (2024). Precise tensor product smoothing via spectral splines. Stats, 7(1), 34-53, doi:10.3390/stats7010003
See Also
plot.gammi
for plotting effects from gammi
objects
Examples
# load 'exam' help file
?exam
# load data
data(exam)
# header of data
head(exam)
# fit model
mod <- gammi(Exam.score ~ VRQ.score, data = exam,
random = ~ (1 | Primary.school) + (1 | Secondary.school))
# plot results (using S3 method)
plot(mod, include.random = FALSE)
# plot results (using visualizer)
xnew <- seq(min(exam$VRQ.score), max(exam$VRQ.score), length.out = 400)
pred <- predict(mod, newdata = data.frame(VRQ.score = xnew),
type = "terms", conf.int = TRUE)
visualizer1(x = xnew, y = pred$fit, lwr = pred$lwr, upr = pred$upr,
xlab = "VRQ.score", ylab = "Exam.score", main = "VRQ.score effect")