Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

difference_smooths

Differences of factor smooth interactions


Description

Differences of factor smooth interactions

Usage

difference_smooths(model, ...)

## S3 method for class 'gam'
difference_smooths(
  model,
  smooth,
  n = 100,
  ci_level = 0.95,
  newdata = NULL,
  unconditional = FALSE,
  frequentist = FALSE,
  ...
)

Arguments

model

A fitted model.

...

arguments passed to other methods.

smooth

character; which smooth to compute differences for.

n

numeric; the number of points at which to evaluate the difference between pairs of smooths.

ci_level

numeric between 0 and 1; the coverage of credible interval.

newdata

data frame of locations at which to evaluate the difference between smooths.

unconditional

logical; account for smoothness selection in the model?

frequentist

logical; use the frequentist covariance matrix?

Examples

load_mgcv()

df <- data_sim("eg4")
m <- gam(y ~ fac + s(x2, by = fac) + s(x0), data = df, method = "REML")

difference_smooths(m, smooth = "s(x2)")

gratia

Graceful 'ggplot'-Based Graphics and Other Functions for GAMs Fitted Using 'mgcv'

v0.6.0
MIT + file LICENSE
Authors
Gavin L. Simpson [aut, cre] (<https://orcid.org/0000-0002-9084-8413>), Henrik Singmann [ctb] (<https://orcid.org/0000-0002-4842-3657>)
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.