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

predict.stanreg

Predict method for stanreg objects


Description

This method is primarily intended to be used only for models fit using optimization. For models fit using MCMC or one of the variational approximations, see posterior_predict.

Usage

## S3 method for class 'stanreg'
predict(
  object,
  ...,
  newdata = NULL,
  type = c("link", "response"),
  se.fit = FALSE
)

Arguments

object

A fitted model object returned by one of the rstanarm modeling functions. See stanreg-objects.

...

Ignored.

newdata

Optionally, a data frame in which to look for variables with which to predict. If omitted, the model matrix is used.

type

The type of prediction. The default 'link' is on the scale of the linear predictors; the alternative 'response' is on the scale of the response variable.

se.fit

A logical scalar indicating if standard errors should be returned. The default is FALSE.

Value

A vector if se.fit is FALSE and a list if se.fit is TRUE.

See Also


rstanarm

Bayesian Applied Regression Modeling via Stan

v2.21.1
GPL (>= 3)
Authors
Jonah Gabry [aut], Imad Ali [ctb], Sam Brilleman [ctb], Jacqueline Buros Novik [ctb] (R/stan_jm.R), AstraZeneca [ctb] (R/stan_jm.R), Trustees of Columbia University [cph], Simon Wood [cph] (R/stan_gamm4.R), R Core Deveopment Team [cph] (R/stan_aov.R), Douglas Bates [cph] (R/pp_data.R), Martin Maechler [cph] (R/pp_data.R), Ben Bolker [cph] (R/pp_data.R), Steve Walker [cph] (R/pp_data.R), Brian Ripley [cph] (R/stan_aov.R, R/stan_polr.R), William Venables [cph] (R/stan_polr.R), Paul-Christian Burkner [cph] (R/misc.R), Ben Goodrich [cre, aut]
Initial release
2020-07-20

We don't support your browser anymore

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