extract_stan: Extract chains of an stanfit object implemented in rstan...

Description Usage Arguments Value Author(s) Examples

View source: R/varstan.R

Description

Extract chains of an stanfit object implemented in rstan package

Usage

1
extract_stan(object,pars,permuted = TRUE,inc_warmup = FALSE,include = TRUE, ...)

Arguments

object

a varstan object

pars

n optional character vector providing the parameter names (or other quantity names) of interest. If not specified, all parameters and other quantities are used. The log-posterior with name lp__ is also included by default.

permuted

A logical scalar indicating whether the draws after the warmup period in each chain should be permuted and merged. If FALSE, the original order is kept. For each stanfit object, the permutation is fixed (i.e., extracting samples a second time will give the same sequence of iterations).

inc_warmup

A logical scalar indicating whether to include the warmup draws. This argument is only relevant if permuted is FALSE.

include

A logical scalar indicating whether the parameters named in pars should be included (TRUE) or excluded (FALSE).

...

Further arguments passed to extract function.

Value

a list with the posterior samples of the provided parameters.

Author(s)

Asael Alonzo Matamoros

Examples

1
2
3
4
5
6
7
 library(astsa)
 # Fitting a GARCH(1,1) model
 dat = garch(ipc,order = c(1,1,0))
 fit2 = varstan(dat,iter = 500,chains = 1)

 # Extracting the mean parameter
 mu0 = extract_stan(fit2,pars = "mu0")

bayesforecast documentation built on June 17, 2021, 5:14 p.m.