plot.gammi: Plot Method for gammi Fits

View source: R/plot.gammi.R

plot.gammiR Documentation

Plot Method for gammi Fits

Description

Plots main and interaction effects from a fit gammi object.

Usage

## S3 method for class 'gammi'
plot(x, terms = x$term.labels, conf.int = TRUE, n = 400,
     intercept = FALSE, random = TRUE, ask = dev.interactive(), 
     xlab = NULL, ylab = NULL, zlab = NULL, main = NULL, ...)

Arguments

x

Object of class "gammi"

terms

Which model term(s) should be plotted? Default plots all terms.

conf.int

Should a 95% confidence interval be added to the plot(s)?

n

Number of points used to plot each of the (continuous) terms.

intercept

Should the intercept be added to the y-axis of the plot(s)?

random

Should Q-Q plots of the random coefficients be produced?

ask

Should the user be asked before each plot is produced?

xlab

Optional x-axis label for plot(s).

ylab

Optional y-axis label for plot(s).

zlab

Optional z-axis label for plot(s).

main

Optional title for plot(s).

...

Additional arguments passed to internal plotting functions.

Details

Default use plots each effect function along with a 95% confidence interval (if applicable). Line plots are used for continuous predictors, bar plots are used for categorical predictors, Q-Q plots are used for random effects, and image plots are used for two-way interactions. The visualizer1 and visualizer2 functions are used to plot main and interaction effects, respectively.

Value

A plot is produced and nothing is returned.

Note

Three-way and higher-order interactions are not currently supported.

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, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3390/stats7010003")}

See Also

gammi for fitting generalized additive mixed models

predict.gammi for predicting from gammi objects

summary.gammi for summarizing results from gammi objects

Examples

# load 'gammi' package
library(gammi)

# 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 terms
plot(mod)

# refit model with Secondary.school as penalized nominal effect
mod <- gammi(Exam.score ~ Secondary.school + VRQ.score, data = exam,
             random = ~ (1 | Primary.school))
             
# plot terms
plot(mod)

gammi documentation built on April 4, 2025, 4:48 a.m.

Related to plot.gammi in gammi...