View source: R/posterior_samples.R
stan_fit_convert | R Documentation |
This function converts a Stan fit object into an array of samples for the
temporal coefficients and the innovation covariance or partial correlation
matrices. It supports rstan
as a backend. It can be used to convert models
fit using stan_gvar
into 3D arrays, which is the standard data structure
used in tsnet
. The function allows to select which parameters should be
returned.
stan_fit_convert(stan_fit, return_params = c("beta", "sigma", "pcor"))
stan_fit |
A Stan fit object obtained from rstan or a tsnet_fit object
from |
return_params |
A character vector specifying which parameters to
return. Options are "beta" (temporal network), "sigma" (innovation
covariance), and "pcor" (partial correlations). Default is
|
A list containing 3D arrays for the selected parameters. Each array represents the posterior samples for a parameter, and each slice of the array represents a single iteration.
data(ts_data)
example_data <- ts_data[1:100,1:3]
fit <- stan_gvar(data = example_data,
n_chains = 2,
n_cores = 1)
samples <- stan_fit_convert(fit, return_params = c("beta", "pcor"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.