bcdd_mcmc: The MCMC algorithm for Constrained Bayes density...

Description Usage Arguments Value Examples

Description

The main function bcdd_mcmc in this package can be used to deconvolve a density with a unimodal and symmetric shape. The method is coined the name Constrained Bayes and is essentially a nonparametric approach using Bayesian hierarchical models. The speed is bumped by utilizing functions written in Rcpp.

Usage

1
2
bcdd_mcmc(w, sd_u, n.burnin = 1000, n.MCMC = 5000, hpar = list(m = 20, K =
  8, Xi_1 = 1, Xi_2 = 4, lambda = 2, shape.lambda = 2, tt = 2.5))

Arguments

w

A vector containing the proxy variables.

sd_u

A vector containing the standard deviation of error, if the error is homoscedastic, then it should be a scalar.

n.burnin

A number (default 1000) specifies the number of burning steps.

n.MCMC

A number (default 5000) specifies the number of total MCMC steps.

hpar

A list containing the hyperparameters in the algorithm, the default values are chosen if left empty. m is the concentration parameter and K is the number of categories of Dirichlet distribution prior for p. Xi_1, Xi_2 are the shape and rate parameters of the Gamma prior for beta. lambda is the rate parameter of the exponential prior for alpha. shape.lambda is one parameter in the proposal distribution for the MH step of alpha. tt corresponds to the lower bound that is prespecified for alpha.

Value

A list containing the expected posterior density of the latent true variable (y) evaluated on a grid (x) chosen automatically in the function.

Examples

1
2
3
4
5
6
7
8
df.t <- 5
n <- 500
x <- rt(n, df = df.t)
sd_u <- 1.29
u <- rnorm(n, mean = 0, sd = sd_u)               
w <- x + u
res <- bcdd_mcmc(w, sd_u, n.burnin=100, n.MCMC=500)
plot(res$x, res$y, type="l", xlab="x", ylab=NULL)

tamustatsy/bcdd documentation built on May 7, 2019, 9:39 a.m.