Learn R Programming

modelbased (version 0.5.1)

estimate_smooth.stanreg: Describe the smooth term (for GAMs) or non-linear predictors

Description

Describe the smooth term (for GAMs) or non-linear predictors

Usage

# S3 method for stanreg
estimate_smooth(
  model,
  smooth = NULL,
  levels = NULL,
  length = 200,
  transform = "response",
  centrality = "median",
  ...
)

Arguments

model

A Bayesian model.

smooth

A character indicating the name of the "smooth" term.

levels

A character vector indicating the variables over which the slope will be computed. If NULL (default), it will select all the remaining predictors.

length

Passed to visualisation_matrix if data = "grid".

transform

Can be "none" (default for contrasts), "response" (default for means), "mu", "unlink", "log". "none" will leave the values on scale of the linear predictors. "response" will transform them on scale of the response variable. Thus for a logistic model, "none" will give estimations expressed in log-odds (probabilities on logit scale) and "response" in terms of probabilities.

centrality

The point-estimates (centrality indices) to compute. Character (vector) or list with one or more of these options: "median", "mean", "MAP" or "all".

...

Arguments passed to or from other methods.

Examples

Run this code
# NOT RUN {
library(modelbased)
# }
# NOT RUN {
if (require("rstanarm")) {
  model <- stan_gamm4(Sepal.Width ~ s(Petal.Length), data = iris)
  estimate_smooth(model)

  model <- stan_glm(Sepal.Width ~ poly(Petal.Length, 2), data = iris)
  estimate_smooth(model)

  model <- stan_gamm4(Sepal.Width ~ Species + s(Petal.Length), data = iris)
  estimate_smooth(model)

  model <- stan_glm(Sepal.Width ~ Species * poly(Petal.Length, 2), data = iris)
  estimate_smooth(model)
  estimate_smooth(model, levels = "Species")
}
# }

Run the code above in your browser using DataLab