get_terms: Extract the partial effects of non-linear model terms

Description Usage Arguments Value Examples

Description

This function basically creates a new df from data for each term in terms, creating a range from minimum and maximum of the predict(fit, newdata=df, type="terms"). Terms are then stacked to a tidy data frame.

Usage

1

Arguments

data

A data frame containing variables used to fit the model. Only first row will be used.

fit

A fitted object of class gam.

terms

A character vector (can be length one). Specifies the terms for which partial effects will be returned

...

Further arguments passed to seq_range.

Value

A tibble with 5 columns.

Examples

1
2
3
4
mod <- mgcv::gam(Sepal.Length ~ s(Sepal.Width), data = iris)
terms_df <- iris %>% get_terms(mod, terms = c("Sepal.Width"))
head(terms_df)
tail(terms_df)

adibender/mgcvtools documentation built on May 14, 2019, 7:55 p.m.