Learn R Programming

gammi (version 0.2)

plot.gammi: Plot Method for gammi Fits

Description

Plots main and interaction effects from a fit gammi object.

Usage

# S3 method for 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, ...)

Value

A plot is produced and nothing is returned.

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.

Author

Nathaniel E. Helwig <helwig@umn.edu>

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.

References

Helwig, N. E. (2024). Precise tensor product smoothing via spectral splines. Stats, 7(1), 34-53, 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

Run this code
# 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)

Run the code above in your browser using DataLab