Skip to contents

Evaluate first derivative of GAM smooth(s), adapted from Gavin Simpson.

Usage

Deriv(mod, n = 200, eps = 1e-04, newdata, term)

Arguments

mod

the output of mgcv::gam()

n

number of intervals over which to evaluate each smooth. default 200.

eps

tolerance threshold. default 1e-4.

newdata

optional; data.frame of new smooth parameters to evaluate

term

string smooth name, i.e. "year". must match values in mod and newdata

Value

a vector of derivative values of length n