14  add_numeric_ from call


The examples in Chapter 14 require (see the explanation of the function name conflict in Section 7.4).

library(maxEff)
# Loading required package: groupedHyperframe
# Registered S3 method overwritten by 'pROC':
#   method   from            
#   plot.roc spatstat.explore
search path & loadedNamespaces on author’s computer
search()
#  [1] ".GlobalEnv"                "package:maxEff"            "package:groupedHyperframe" "package:stats"             "package:graphics"          "package:grDevices"         "package:utils"            
#  [8] "package:datasets"          "package:methods"           "Autoloads"                 "package:base"
loadedNamespaces() |> sort.int()
#   [1] "abind"             "base"              "caret"             "class"             "cli"               "cluster"           "codetools"         "compiler"          "data.table"       
#  [10] "datasets"          "deldir"            "digest"            "doParallel"        "dplyr"             "evaluate"          "farver"            "fastmap"           "fastmatrix"       
#  [19] "foreach"           "future"            "future.apply"      "generics"          "geomtextpath"      "GET"               "ggplot2"           "globals"           "glue"             
#  [28] "goftest"           "gower"             "graphics"          "grDevices"         "grid"              "gridExtra"         "groupedHyperframe" "gtable"            "hardhat"          
#  [37] "htmltools"         "htmlwidgets"       "ipred"             "iterators"         "jsonlite"          "knitr"             "lattice"           "lava"              "lifecycle"        
#  [46] "listenv"           "lubridate"         "magrittr"          "MASS"              "Matrix"            "matrixStats"       "maxEff"            "methods"           "ModelMetrics"     
#  [55] "nlme"              "nnet"              "otel"              "parallel"          "parallelly"        "patchwork"         "pillar"            "pkgconfig"         "plyr"             
#  [64] "polyclip"          "pracma"            "pROC"              "prodlim"           "purrr"             "R6"                "RColorBrewer"      "Rcpp"              "recipes"          
#  [73] "reshape2"          "rlang"             "rmarkdown"         "rpart"             "rstudioapi"        "S7"                "scales"            "SpatialPack"       "spatstat.data"    
#  [82] "spatstat.explore"  "spatstat.geom"     "spatstat.random"   "spatstat.sparse"   "spatstat.univar"   "spatstat.utils"    "splines"           "stats"             "stats4"           
#  [91] "stringi"           "stringr"           "survival"          "systemfonts"       "tensor"            "textshaping"       "tibble"            "tidyselect"        "timechange"       
# [100] "timeDate"          "tools"             "utils"             "vctrs"             "viridisLite"       "withr"             "xfun"              "yaml"

🚧 Chapter 14 is being re-written English-wise. All code are correct here, though. Expected delivery by 2025-12-31.

The internal class 'add_numeric_' defined in package maxEff v0.2.1 inherits from the class 'call', with additional attributes

The S3 method base::print.default() displays each 'add_numeric_' object.

Example: training models a0, 1st element
a0[[1L]]
Example: training models a0, 2nd element
a0[[2L]]

The S3 method spatstat.geom::with.hyperframe() obtains the selected numeric predictors by passing the call to parameter ee.

Example: 1st selected numeric predictor
s0 |>
  with(ee = a0[[1L]]) |> # ?spatstat.geom::with.hyperframe
  summary.default()
s1 |>
  with(ee = a0[[1L]]) |> # ?spatstat.geom::with.hyperframe
  summary.default()
Example: 2nd selected numeric predictor
s0 |>
  with(ee = a0[[2L]]) |> # ?spatstat.geom::with.hyperframe
  summary.default()
s1 |>
  with(ee = a0[[2L]]) |> # ?spatstat.geom::with.hyperframe
  summary.default()

The S3 method predict.add_numeric_() is the workhorse of the S3 method predict.add_numeric().

Example: predict.add_numeric_(); predicted models a1, 1st element
a0[[1L]] |> 
  predict(newdata = s1) |>
  identical(y = a1[[1L]]) |>
  stopifnot()
Example: predict.add_numeric_(); predicted models a1, 2nd element
a0[[2L]] |> 
  predict(newdata = s1) |>
  identical(y = a1[[2L]]) |>
  stopifnot()