18  hyper_gam from gam

The examples in Chapter 18 require that the search path contains the following namespaces. See the explanation of the function name conflict in Section 7.3.5.

library(groupedHyperframe)
library(hyper.gam)
# Registered S3 method overwritten by 'pROC':
#   method   from            
#   plot.roc spatstat.explore

Function hyper.gam::hyper_gam() (v0.2.1) creates an R object of the S3 class 'hyper_gam', which inherits from the S3 class 'gam' from package mgcv (Wood 2017, v1.9.3) with an additional attribute,

In addition to the existing S3 method dispatches mgcv::*.gam() (v1.9.3, Listing 18.1),

Listing 18.1: Existing S3 method dispatches mgcv::*.gam
Code
suppressPackageStartupMessages(library(mgcv))
methods(class = 'gam', all.names = TRUE) |> 
  attr(which = 'info', exact = TRUE) |>
  subset.data.frame(subset = (from %in% c('mgcv', 'registered S3method')))
#                    visible                from        generic  isS4
# anova.gam             TRUE                mgcv          anova FALSE
# cooks.distance.gam   FALSE registered S3method cooks.distance FALSE
# formula.gam           TRUE                mgcv        formula FALSE
# influence.gam         TRUE                mgcv      influence FALSE
# logLik.gam            TRUE                mgcv         logLik FALSE
# model.matrix.gam      TRUE                mgcv   model.matrix FALSE
# plot.gam              TRUE                mgcv           plot FALSE
# predict.gam           TRUE                mgcv        predict FALSE
# print.gam             TRUE                mgcv          print FALSE
# residuals.gam         TRUE                mgcv      residuals FALSE
# summary.gam           TRUE                mgcv        summary FALSE
# vcov.gam              TRUE                mgcv           vcov FALSE

Package hyper.gam (v0.2.1) implements more S3 method dispatches to the class 'gam' (Listing 18.2, Table 18.1),

Listing 18.2: Table: S3 method dispatches hyper.gam::*.gam
Code
methods2kable(class = 'gam', package = 'hyper.gam', all.names = TRUE)
Table 18.1: S3 method dispatches hyper.gam::*.gam (v0.2.1)
visible from generic isS4
getData.gam TRUE hyper.gam nlme::getData FALSE

Package hyper.gam (v0.2.1) implements the following S3 method dispatches to the class 'hyper_gam' (Listing 18.3, Table 18.2),

Listing 18.3: Table: S3 method dispatches hyper.gam::*.hyper_gam
Code
methods2kable(class = 'hyper_gam', package = 'hyper.gam', all.names = TRUE)
Table 18.2: S3 method dispatches hyper.gam::*.hyper_gam (v0.2.1)
visible from generic isS4
contour.hyper_gam TRUE hyper.gam graphics::contour FALSE
cor_xy.hyper_gam TRUE hyper.gam hyper.gam::cor_xy FALSE
persp.hyper_gam TRUE hyper.gam graphics::persp FALSE
predict.hyper_gam TRUE hyper.gam stats::predict FALSE
sign_adjust.hyper_gam TRUE hyper.gam hyper.gam::sign_adjust FALSE
update.hyper_gam TRUE hyper.gam stats::update FALSE

18.1 Sign Adjustment

The S3 generic functions hyper.gam::sign_adjust() and hyper.gam::cor_xy() ..

🚧 Rest of this section is under construction. Expected delivery by 2025-12-31.

18.2 Visualization

The S3 method dispatches contour.hyper_gam() and persp.hyper_gam() .. Listing 5.1 ..

🚧 Rest of this section is under construction. Expected delivery by 2025-12-31.

Visualization of the integrand surface (Chapter 5, Equation 5.3) in functions integrandSurface(), persp.hyper_gam() and contour.hyper_gam() is inspired by function mgcv::vis.gam(). Visualization of the integrand paths, as well as their projections on the \((p,q)\)- and \((p,s)\)-plane, is an original idea and design by Tingting Zhan.

18.3 Prediction

The S3 method dispatch hyper.gam::predict.hyper_gam() calculates the quantile index predictors of the training and/or test data set, based on the training model m1a (Chapter 5, Listing 5.2). The returned value is a numeric vector.

Function hyper.gam::predict.hyper_gam() is a convenient wrapper and slight modification of the S3 method dispatch mgcv::predict.gam(). The use of S3 generic stats::predict(), which is typically for predicted values, could be confusing, but we choose to follow the practice and nomenclature of function mgcv::predict.gam().

18.4 Update

The S3 method dispatch update.hyper_gam()

🚧 Rest of this section is under construction. Expected delivery by 2025-12-31.