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

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

Arguments

x

gam model

...

unused argument

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.9-1. For overview type 'help("mgcv-package")'.
#> Gu & Wahba 4 term additive model

Component

Term

Estimate

Std Error

t-value

p-value

A. parametric coefficients

(Intercept)

-0.012

0.359

-0.033

0.9734

Component

Term

edf

Ref. df

F-value

p-value

B. smooth terms

s(x0)

1.000

1.001

0.280

0.5968

s(x1)

4.198

5.163

5.361

0.0001

***

s(x2)

4.023

4.962

14.928

0.0000

***

s(x3)

3.768

4.666

18.222

0.0000

***

Signif. codes: 0 <= '***' < 0.001 < '**' < 0.01 < '*' < 0.05

Adjusted R-squared: -0.843, Deviance explained -5.284

GCV : 53.560, Scale est: 51.687, N: 400