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

dlmGibbsDIG

Gibbs sampling for d-inverse-gamma model


Description

The function implements a Gibbs sampler for a univariate DLM having one or more unknown variances in its specification.

Usage

dlmGibbsDIG(y, mod, a.y, b.y, a.theta, b.theta, shape.y, rate.y,
            shape.theta, rate.theta, n.sample = 1,
            thin = 0, ind, save.states = TRUE,
            progressBar = interactive())

Arguments

y

data vector or univariate time series

mod

a dlm for univariate observations

a.y

prior mean of observation precision

b.y

prior variance of observation precision

a.theta

prior mean of system precisions (recycled, if needed)

b.theta

prior variance of system precisions (recycled, if needed)

shape.y

shape parameter of the prior of observation precision

rate.y

rate parameter of the prior of observation precision

shape.theta

shape parameter of the prior of system precisions (recycled, if needed)

rate.theta

rate parameter of the prior of system precisions (recycled, if needed)

n.sample

requested number of Gibbs iterations

thin

discard thin iterations for every saved iteration

ind

indicator of the system variances that need to be estimated

save.states

should the simulated states be included in the output?

progressBar

should a text progress bar be displayed during execution?

Details

The d-inverse-gamma model is a constant univariate DLM with unknown observation variance, diagonal system variance with unknown diagonal entries. Some of these entries may be known, in which case they are typically zero. Independent inverse gamma priors are assumed for the unknown variances. These can be specified be mean and variance or, alternatively, by shape and rate. Recycling is applied for the prior parameters of unknown system variances. The argument ind can be used to specify the index of the unknown system variances, in case some of the diagonal elements of W are known. The unobservable states are generated in the Gibbs sampler and are returned if save.states = TRUE. For more details on the model and usage examples, see the package vignette.

Value

The function returns a list of simulated values.

dV

simulated values of the observation variance.

dW

simulated values of the unknown diagonal elements of the system variance.

theta

simulated values of the state vectors.

Author(s)

Giovanni Petris GPetris@uark.edu

References

Giovanni Petris (2010), An R Package for Dynamic Linear Models. Journal of Statistical Software, 36(12), 1-16. http://www.jstatsoft.org/v36/i12/.
Petris, Petrone, and Campagnoli, Dynamic Linear Models with R, Springer (2009).

Examples

## See the package vignette for an example

dlm

Bayesian and Likelihood Analysis of Dynamic Linear Models

v1.1-5
GPL (>= 2)
Authors
Giovanni Petris [aut, cre], Wally Gilks [ctb] (Author of original C code for ARMS)
Initial release
2018-05-30

We don't support your browser anymore

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