Skip to contents

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

Usage

# 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)

7.833

0.099

79.303

0.0000

***

Component

Term

edf

Ref. df

F-value

p-value

B. smooth terms

s(x0)

2.500

3.115

6.921

0.0001

***

s(x1)

2.401

2.984

81.858

0.0000

***

s(x2)

7.698

8.564

88.158

0.0000

***

s(x3)

1.000

1.000

4.343

0.0378

*

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

Adjusted R-squared: 0.715, Deviance explained 0.725

GCV : 4.051, Scale est: 3.903, N: 400