Description Usage Arguments Details Value Author(s) References See Also Examples
Calculates the posterior model density, q1(.), normalised density, q2(.), and their ratio, l(.), for a set of simulated parameters.
1 |
bug |
A BUGS model created in the tsbugs package. |
sims |
A |
ymean |
A |
hmean |
A |
MU |
A vector of the mean parameter values (over a simulated data set) |
COV |
A matrix of parameter variance-covariances (over a simulated data set) |
P |
A |
Returns a data.frame
with three columns. The first column returns q1(.), the second q2(.) and third l(.) for a given set of simulations. Will only operate for simulations from BUGS models with either constant variance, stochastic volatility or a random variance shift created in the tsbugs package. This function is intended to be run twice in order to obtain 1) q1(w1) and q2(w1) based on a unnormalised MCMC simulation (w1) and 2) q1(w2) and q2(w2) based on a simulations from a normalised density (w2).
Values of q1
are based on posterior model densities calculated in either the dcvts
, dsvts
or drvts
. Values of q2
are based on densities of a multivariate normal distribution (using MU
and COV
in the dmvnorm
function of the mvtnorm
package) when the BUGS model (bug
) has a constant variance or stochastic volatility component. When BUGS model has a random variance shift component, the q2
density is estimated using the dmvnb
function.
The data.frame
outputs can be directly used as input into the bridge
function to obtain estimates of normalising constants.
A data.frame
with columns:
q1 |
Unnormalised Density. |
q2 |
Normalised Density. |
l |
Ratio of |
Guy J. Abel
Abel, G.J., Bijak, J., Forster, J.J., Raymer J., Smith P.W.F. and Wong, J.S.T. (2013) Integrating uncertainty in time series population forecasts: An illustration using a simple projection model. Demographic Research. 29 43 1187-1226 doi:10.4054/DemRes.2013.29.43
Alan Genz, Frank Bretz, Tetsuhisa Miwa, Xuefei Mi, Friedrich Leisch, Fabian Scheipl, Torsten Hothorn (2012). mvtnorm: Multivariate Normal and t Distributions. R package version 0.9-9994. http://CRAN.R-project.org/package=mvtnorm
Meng, X.-L., & Wong, W. H. (1996). Simulating Ratios of Normalizing Constants via a Simple Identity: A Theoretical Exploration. Statistica Sinica, 6, 831-860.
dcvts
, dsvts
, drvts
, dmvnb
, dmvnorm
, bridge
1 2 3 4 5 6 | ## Not run:
# demo example with constant variance models for differenced growth rate
# of England and Wales population as used in Abel et. al. (2013)
demo("cv_bma", "tsbridge")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.