| bdeconv | R Documentation |
Obtaining MCMC samples from the posterior
bdeconv(
obj,
lwr = 0,
upr = NULL,
wgts = NULL,
regular_var = NULL,
res_type = c("final", "mean", "all"),
err_type = c("flex", "norm", "lapl"),
var_type = c("heteroscedastic", "homoscedastic"),
na_rm = FALSE,
control = list(),
progress = FALSE,
core_num = 1,
parallel = FALSE
)
obj |
A data frame where the first column is subject labels. |
lwr |
Unused. |
upr |
The ratio of an upper bound for the deconvolved estimates to the upper bound of the surrogates. It can be either a
scalar or a vector with a length that matches the number of numeric columns
in |
wgts |
Unused. |
regular_var |
Specifies which variables to consider as regular; all others are treated as zero inflated. |
res_type |
The type of result returned from the MCMC sampler. |
err_type |
The shape of the error distribution used for deconvolution. |
var_type |
whether to use homogeneous or heterogeneous error distribution. |
na_rm |
A logical value indicating whether to ignore rows which contain
|
control |
A list of arguments specifying prior hyper-parameters and parameters of the MCMC sampler. |
progress |
Whether a progress bar for MCMC will be shown or not. Default is FALSE. |
core_num |
If parallelized, number of cores to be used. |
parallel |
For multivariate data. Whether the pre-processing of each variable will be parallelized or not. Default is FALSE. |
Performs univariate and multivariate Bayesian semiparametric density deconvolution when the true latent distribution of main interest and the measurement error distribution are both unknown, the errors may be conditionally heteroscedastic, and replicated proxies are available for each individual in the sample.
Currently, the support of all univariate densities of main interest must be nonnegative; so negative proxies are not allowed. If negative proxies are observed, they must be shifted to the right to make them all nonnegative first. All hyper-parameters of the model and variables necessary for the MCMC sampler can be specified through a list via the control argument; some of the most important ones are listed.
nsamp: Number of finally retained MCMC samples after burn-in and thinning. Default is 1000.
nburn: Burn-in period. Default is 2000.
nthin: Thinning interval. Default is 5.
niter_uni: For multivariate data, number of iteration for pre-processing of each variable. Default is 500.
K_t: Number of knot points for bspline. Default is 10.
K_x: Number of mixture components in the model for the density of X when the surrogates are strictly continuous. Not applicable when the surrogates are zero-inflated in which case the density is modeled using normalized bsplines. Default is 10.
K_epsilon: Number of mixture components in the model for the density of scaled errors when applicable. Default is 10.
sigmasq_epsilon: variance parameter for the normal prior of the scaled error mixture components' location parameter. Default is 4.
a_epsilon: shape parameter for the inverse gamma prior of the variances of scaled error mixture components. Default is 3.
b_epsilon: rate parameter for the inverse gamma prior of the variances of scaled error mixture components. Default is 1.
a_vartheta: shape parameter for the inverse gamma prior of the variances of bspline coefficients corresponding to the variance function. Default is 100.
b_vartheta: rate parameter for the inverse gamma prior of the variances of bspline coefficients corresponding to the variance function. Default is 1.
a_xi: shape parameter for the inverse gamma prior of the variances of bspline coefficients corresponding to the densities of episodic components. Default is 100.
b_xi: rate parameter for the inverse gamma prior of the variances of bspline coefficients corresponding to the densities of episodic components. Default is 10.
a_beta: shape parameter for the inverse gamma prior of the variances of bspline coefficients corresponding to the probability of consumption function. Default is 100.
b_beta: rate parameter for the inverse gamma prior of the variances of bspline coefficients corresponding to the probability of consumption function. Default is 1.
A bdeconv_result object, containing all the posterior samples, suitable for further analysis and visualization.
data(BayesDecon_data_simulated)
set.seed(123)
### Selecting first 300 rows for demonstration.
### For best results, using the whole data is recommended.
result_uni <- bdeconv(BayesDecon_data_simulated[1:300,c(1,2)],
upr = 1, res_type = "all",
control = list(nsamp = 500, nburn = 0, nthin = 1),
progress = TRUE)
plot(result_uni)
set.seed(123)
result_mult <- bdeconv(BayesDecon_data_simulated, upr = 1, res_type = "all", progress = TRUE)
plot(result_mult)
plot(result_mult[,c(1,2)])
value = rbind(c(1,1,1),c(2,2,2),c(3,3,3),c(4,4,4))
colMeans(dist_x(result_mult, vals = value))
colMeans(dens_x(result_mult, vals = value))
print(result_mult)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.