Compute the posterior density of the coefficient function.

compute_beta_posterior_density(beta_sample, param)

Arguments

beta_sample

a matrix. Each row is a coefficient function computed from the posterior sample.

param

a list containing:

grid

a numerical vector, the time points.

lims_estimate

a numerical vector, the time points.

burnin

an integer (optional), the number of iteration to drop from the Gibbs sample.

lims_kde

an integer (optional), correspond to the lims option of the kde2d funtion.

new_grid

a numerical vector (optional) to compute beta sample on a different grid.

thin

an integer (optional) to thin the posterior sample.

Value

An approximation of the posterior density on a two-dimensional grid (corresponds to the result of the kde2d function).

Details

The posterior densities correponds to approximations of the marginal posterior distribitions (of beta(t) for each t). The sample is thinned in order to reduce the correlation and the computational time of the function kde2d.

Examples

# \donttest{
library(RColorBrewer)
data(data1)
data(param1)
data(res_bliss1)
param1$grids <- data1$grids
param1$p <- sapply(data1$grids,length)
param1$Q <- length(data1$x)

density_estimate <- compute_beta_posterior_density(res_bliss1$beta_sample,param1)
# }