estimate_ssmodel {sectorgap}R Documentation

Bayesian estimation via Gibbs sampling

Description

Estimates the parameters and states of a multi-dimensional state space model by Bayesian methods using a Gibbs sampling procedure.

Usage

estimate_ssmodel(
  model,
  settings,
  data,
  prior = initialize_prior(model),
  R = 10000,
  burnin = 0.5,
  thin = 1,
  HPDIprob = 0.68,
  fit = NULL
)

Arguments

model

state space model object, returned by the function define_ssmodel

settings

list with model setting, in the format returned by the function initialize_settings

data

list with at least two named components: tsm is a multiple time series object that contains all observation series, weights is a named list of time series with (nominal) weights, the list names correspond to the different groups, i.e., group1, group2, subgroup1, if present in the model

prior

list of matrices, each list item corresponds to one endogenous variable. See initialize_prior

R

number of draws, the default is 10000

burnin

share of draws as burnin period, the default is 0.5

thin

thinning parameter defining how many draws are discarded. 1 means no draw is discarded, 2 means each second draw is kept, and so on

HPDIprob

probability of highest posterior density interval, the default is HPDIprob = 0.68

fit

already fitted object of class ss_fit, to continue drawing, see details

Details

If fit is supplied, the function will continue drawing R additional repetitions. In this case, all input variables except for fit and R are ignored.

Value

An object of class ss_fit.

Examples

data("data_ch")
settings <- initialize_settings()
data <- prepate_data(
  settings = settings,
  tsl = data_ch$tsl,
  tsl_n = data_ch$tsl_n
)
model <- define_ssmodel(
  settings = settings, 
  data = data
)
prior <- initialize_prior(
  model = model, 
  settings = settings
) 

fit <- estimate_ssmodel(
  model = model, 
  settings = settings, 
  data = data,
  prior = prior,
  R = 100
)


[Package sectorgap version 0.1.0 Index]