compute_beta_sample: compute_beta_sample

View source: R/basic_functions.R

compute_beta_sampleR Documentation

compute_beta_sample

Description

Compute the posterior coefficient function from the posterior sample.

Usage

compute_beta_sample(posterior_sample, param, Q, verbose = FALSE)

Arguments

posterior_sample

a list provided by the function Bliss_Gibbs_Sampler.

param

a list containing:

K

a vector of integers, corresponding to the numbers of intervals for each covariate.

grids

a numerical vector, the observation time points.

basis

a vector of characters (optional) among : "uniform" (default), "epanechnikov", "gauss" and "triangular" which correspond to different basis functions to expand the coefficient function and the functional covariates.

Q

numeric

verbose

write stuff if TRUE (optional).

Value

return a matrix containing the coefficient function posterior sample.

Examples

library(RColorBrewer)
data(data1)
data(param1)
param1$grids<-data1$grids
# result of res_bliss1<-fit_Bliss(data=data1,param=param1)
data(res_bliss1)
beta_sample <- compute_beta_sample(posterior_sample=res_bliss1$posterior_sample,
                                   param=param1,Q=1)
indexes <- sample(nrow(beta_sample[[1]]),1e2,replace=FALSE)
cols <- colorRampPalette(brewer.pal(9,"YlOrRd"))(1e2)
matplot(param1$grids[[1]],t(beta_sample[[1]][indexes,]),type="l",lty=1,col=cols,
xlab="grid",ylab="")

pmgrollemund/bliss documentation built on Feb. 28, 2024, 12:35 p.m.