details_linear_reg_stan: Linear regression via Bayesian Methods

Description Details

Description

The "stan" engine estimates regression parameters using Bayesian estimation.

Details

For this engine, there is a single mode: regression

Tuning Parameters

This engine has no tuning parameters.

Important engine-specific options

Some relevant arguments that can be passed to set_engine():

See rstan::sampling() and rstanarm::priors() for more information on these and other options.

Translation from parsnip to the original package

linear_reg() %>% 
  set_engine("stan") %>% 
  translate()
1
2
3
4
5
6
7
## Linear Regression Model Specification (regression)
## 
## Computational engine: stan 
## 
## Model fit template:
## rstanarm::stan_glm(formula = missing_arg(), data = missing_arg(), 
##     weights = missing_arg(), family = stats::gaussian, refresh = 0)

Note that the refresh default prevents logging of the estimation process. Change this value in set_engine() to show the MCMC logs.

Preprocessing requirements

Factor/categorical predictors need to be converted to numeric values (e.g., dummy or indicator variables) for this engine. When using the formula method via fit.model_spec(), parsnip will convert factor columns to indicators.

Other details

For prediction, the "stan" engine can compute posterior intervals analogous to confidence and prediction intervals. In these instances, the units are the original outcome and when std_error = TRUE, the standard deviation of the posterior distribution (or posterior predictive distribution as appropriate) is returned.

Examples

The “Fitting and Predicting with parsnip” article contains examples for linear_reg() with the "stan" engine.

References


parsnip documentation built on July 21, 2021, 5:08 p.m.