vif.gam: Variance Inflation Factor

Description Usage Arguments Value Examples

View source: R/vif.gam.R

Description

This function takes a fitted mgcv model object and returns a data frame of variance inflation factors

Usage

1
vif.gam(object)

Arguments

object

An object of class gam

Value

VIF.df A data frame consisting of the VIF values for each parametric term in a fitted Generalised Additive Model

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(mgcv)
library(dplyr)

set.seed(101)
N <- 100
x1 <- runif(n=N)
x2 <- runif(n=N)
x3 <- runif(n=N) + 0.9*x1 - 1.75*x2

df <- data.frame(x1 = x1,
                 x2 = x2,
                 x3 = x3) %>%
  mutate(y = rnorm(n=N,
                   mean = 1 - 2*x1 + 3*x2 - 0.5*x3,
                   sd = 0.5))

fit1 <- gam(data=df, y ~ x1 + x2 + x3)

summary(fit1)

vif.gam(fit1)

samclifford/mgcv.helper documentation built on Oct. 10, 2019, 6:05 p.m.