posterior_x_at_fy: posterior_x_at_fy

View source: R/posterior_x_at_fy.R

posterior_x_at_fyR Documentation

posterior_x_at_fy

Description

Find the posterior distribution of the value of a predictor variable at a particular point along the derivative. For instance, one might be interested in knowing the age value at which a slope is steepest, or closest to zero.

Usage

posterior_x_at_fy(
  object,
  term,
  n,
  eps,
  find = c("min", "max", "value"),
  value = NULL,
  multimodal = TRUE,
  adjust = 1,
  prob = 0.95,
  summary_only = FALSE
)

posterior_x_at_miny(...)

posterior_x_at_maxy(...)

posterior_x_at_yequalto(...)

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.

find

the spot along the derivative to find; can be 'min', 'max', or 'value', in which case the value parameter must be set.

value

if find is set to 'value', this must be set to a specific value, like 0.

multimodal

if the expected posterior might be multimodal, set this to TRUE so that the summary is a true, possibly discontinuous, highest posterior density interval.

adjust

passed to density to adjust bandwidth.

prob

the proportion of mass within the HPDI

summary_only

set this to FALSE if you want all samples returned.

Details

posterior_x_at_miny, posterior_x_at_maxy, and posterior_x_at_yequalto are aliases of posterior_x_at_fy where find is set to 'min', 'max', or 'value', respectively and are provided in case they make for more readable code.

Value

An object of class curvish.param that contains the summary from hdi, and the posterior samples. If summary_only is TRUE, the only the output from hdi is returned.


jflournoy/curvish documentation built on May 4, 2023, 3:57 a.m.