A Gibbs Sampler algorithm to sample the posterior distribution of the Bliss model.
Bliss_Gibbs_Sampler(data, param, verbose = FALSE)
a list containing:
an integer, the number of functional covariates.
a numerical vector, the outcome values y_i
.
a list of matrices, the qth matrix contains the observations of the
qth functional covariate at time points given by grids
.
a list of numerical vectors, the qth vector is the grid of time points for the qth functional covariate.
a list containing:
an integer, the number of iterations of the Gibbs sampler algorithm.
a vector of integers, corresponding to the numbers of intervals for each covariate.
an integer, the number of time points.
a character vector (optional). The possible values are "uniform" (default), "epanechnikov", "gauss" and "triangular" which correspond to different basis functions to expand the coefficient function and the functional covariates
a numerical (optional). An hyperparameters related to the exponential prior on the length of the intervals. Lower values promotes wider intervals.
write stuff if TRUE (optional).
a list containing :
a matrix, the trace of the Gibbs Sampler.
a list containing parameters used to run the function.
# \donttest{
# May take a while
param_sim <- list(Q=1,n=25,p=50,grids_lim=list(c(0,1)),iter=1e4,K=2)
data_sim <- sim(param_sim,verbose=FALSE)
res_Bliss_Gibbs_Sampler <- Bliss_Gibbs_Sampler(data_sim,param_sim)
theta_1 <- res_Bliss_Gibbs_Sampler$trace[1,]
theta_1
#> b_1 b_2 m_1 m_2 l_1 l_2
#> 0.00804653 -0.90956946 23.00000000 47.00000000 10.00000000 5.00000000
#> mu sigma_sq
#> -8.11190055 1.12974851
# Resultat for few iterations
param_sim <- list(Q=1,n=25,p=50,grids_lim=list(c(0,1)),iter=5e2,K=2)
data_sim <- sim(param_sim,verbose=FALSE)
res_Bliss_Gibbs_Sampler <- Bliss_Gibbs_Sampler(data_sim,param_sim)
theta_1 <- res_Bliss_Gibbs_Sampler$trace[1,]
theta_1
#> b_1 b_2 m_1 m_2 l_1 l_2 mu
#> -0.1686353 -0.6229595 19.0000000 32.0000000 6.0000000 1.0000000 -4.7720109
#> sigma_sq
#> 0.6015926
# }