Learn R Programming

bliss (version 1.0.2)

Bliss_Gibbs_Sampler: Bliss_Gibbs_Sampler

Description

A Gibbs Sampler algorithm to sample the posterior distribution of the Bliss model.

Usage

Bliss_Gibbs_Sampler(data, param, verbose = FALSE)

Arguments

data

a list containing:

Q

an integer, the number of functional covariates.

y

a numerical vector, the outcome values y_i.

x

a list of matrices, the qth matrix contains the observations of the qth functional covariate at time points given by grids.

grids

a list of numerical vectors, the qth vector is the grid of time points for the qth functional covariate.

param

a list containing:

iter

an integer, the number of iterations of the Gibbs sampler algorithm.

K

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

p

an integer, the number of time points.

basis

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

verbose

write stuff if TRUE (optional).

Value

a list containing :

trace

a matrix, the trace of the Gibbs Sampler.

param

a list containing parameters used to run the function.

Examples

Run this code
# NOT RUN {
# 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
# 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
# }

Run the code above in your browser using DataLab