compute_beta_posterior_density {bliss}R Documentation

compute_beta_posterior_density

Description

Compute the posterior density of the coefficient function.

Usage

compute_beta_posterior_density(beta_sample, param, verbose = FALSE)

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.

verbose

write stuff if TRUE (optional).

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.

Value

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

Examples


library(RColorBrewer)
data(data1)
data(param1)
# result of res_bliss1<-fit_Bliss(data=data1,param=param1)
data(res_bliss1)
q <- 1
param_beta_density <- list(grid= data1[["grids"]][[q]],
                           iter= param1[["iter"]],
                           p   = param1[["p"]][q],
                           n        = length(data1[["y"]]),
                           thin     = param1[["thin"]],
                           burnin   = param1[["burnin"]],
                           lims_kde = param1[["lims_kde"]][[q]],
                           new_grid = param1[["new_grids"]][[q]],
                           lims_estimate = range(res_bliss1$Smooth_estimate[[q]]))
density_estimate <- compute_beta_posterior_density(res_bliss1$beta_sample[[q]],param_beta_density)
image(density_estimate$grid_t,
      density_estimate$grid_beta_t,
      density_estimate$density,col=rev(heat.colors(100)))


[Package bliss version 1.0.4 Index]