Computes the derivative of a smooth term from the posterior of the smooth.

derivatives(
  object,
  term,
  n = 200,
  eps = 1e-05,
  prob = 0.95,
  prob_outer = 0.99,
  order = 1,
  deriv_posterior = TRUE
)

Arguments

object

a brmsfit object

term

character; the smooth term for which the derivative is required.

n

numeric; the number of points to evaluate the derivative at.

eps

numeric; the finite difference.

prob

numeric; the density of the posterior summary.

prob_outer

numeric; the outer density of the posterior summary.

order

integer; the order of the derivative. Only first (1) and second (2) are supported.

deriv_posterior

return the posterior samples for the derivative as part of the object?

Value

a curvish object containing summaries of the posterior derivative, posterior smooths.