produce a flextable describing a generalized additive model produced by function mgcv::gam.

# S3 method for gam
as_flextable(x, ...)

Arguments

x

gam model

...

unused argument

Illustrations

See also

Examples

if (require("mgcv")) {
  set.seed(2)

  # Simulated data
  dat <- gamSim(1, n = 400, dist = "normal", scale = 2)

  # basic GAM model
  b <- gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat)

  ft <- as_flextable(b)
  ft
}
#> Loading required package: mgcv
#> Loading required package: nlme
#> This is mgcv 1.8-38. For overview type 'help("mgcv-package")'.
#> Gu & Wahba 4 term additive model
#> a flextable object.
#> col_keys: `Component`, `Term`, `Estimate`, `Std.Error`, `t.value`, `p.value` 
#> header has 1 row(s) 
#> body has 6 row(s) 
#> original dataset sample: 
#>                    Component        Term Estimate  Std.Error  t.value
#> 1 A. parametric coefficients (Intercept) 7.833279 0.09877608 79.30340
#> 2                       <NA>        <NA>       NA         NA       NA
#> 3            B. smooth terms       s(x0) 2.500168 3.11511478  6.92061
#> 4            B. smooth terms       s(x1) 2.401079 2.98381712 81.85763
#> 5            B. smooth terms       s(x2) 7.697714 8.56432339 88.15792
#>         p.value
#> 1 9.155704e-241
#> 2            NA
#> 3  1.312284e-04
#> 4  0.000000e+00
#> 5  0.000000e+00