Gibbs_Sampler {MSIMST}R Documentation

The Associated Gibbs Sampler

Description

This is the Gibbs sampler associated with the proposed single-index mixed-effects model. This Gibbs sampler supports three different likelihoods, normal, skew-normal and skew-t likelihoods and two types of priors for the single-index funcion: the Gaussian process (GP) prior and the bernstein polynomial (BP) prior.

Usage

Gibbs_Sampler(
  X,
  y,
  group_info,
  beta_value,
  beta_prior_variance,
  beta_b_value,
  beta_lambdasq_value,
  beta_tausq_value,
  xi_value,
  xi_lengthscale_value,
  xi_tausq_value,
  g_func_type,
  dsq_value,
  sigmasq_value,
  delta_value,
  nu_value,
  U_value,
  S_value,
  loglik_type,
  gof_K,
  gof_L,
  iter_warmup,
  iter_sampling,
  verbatim,
  update = 10,
  incremental_output = FALSE,
  incremental_output_filename = NULL,
  incremental_output_update = 1e+06,
  n_core = 1
)

Arguments

X

The list of design matrix.

y

The list of response values.

group_info

The group information for the grouped horseshoe prior. Use 0 to represent the variables with the normal priors. Use 1,2,... to present the variables with the grouped horseshoe priors. For example, c(0,0,1,1,2,3) represents first two variables with the normal prior, third and fourth variables belong to the same group with one grouped horseshoe prior, and fifth and sixth variables belong to two different groups with two independent horseshoe prior.

beta_value

The initial value for the covariates' coefficients.

beta_prior_variance

The variance value of the normal prior.

beta_b_value

The slope parameter.

beta_lambdasq_value

The first hyperparameter associated with the grouped horseshoe prior.

beta_tausq_value

The second hyperparameter associated with the grouped horseshoe prior.

xi_value

The parameters associated with the single index function.

xi_lengthscale_value

The first hyperparameter associated with the Gaussian process kernel.

xi_tausq_value

The second hyperparameter associated with the Gaussian process kernel.

g_func_type

The type of priors on the single index function. Must be one of "GP" and "BP".

dsq_value

The initial value of the conditional variance of the random effects.

sigmasq_value

The initial value of the conditional variance of the fixed effects.

delta_value

The initial value of the skewness parameter.

nu_value

The initial value of the degree of freedom. Must be larger than 2.

U_value

The initial values of the latent variable U. The length of ⁠U_value⁠ must be as the same as the number of subjects.

S_value

The initial values of the latent variable S. The length of ⁠S_value⁠ must be as the same as the number of subjects.

loglik_type

The type of the log-likelihood. Must be one of "skewT","skewN", and "N".

gof_K

The first hyperparameter associated with the goodness of fit test. Check (Yuan and Johnson 2012) for details.

gof_L

The second hyperparameter associated with the goodness of fit test. Check (Yuan and Johnson 2012) for details.

iter_warmup

The number of warm-up iterations of the Gibb samplers.

iter_sampling

The number of post warm-up iterations of the Gibb samplers.

verbatim

TRUE/FALSE. If verbatim is TRUE, then the updating message of the Gibbs sampler will be printed.

update

An integer. For example, if ⁠update⁠ = 10, for each 10 iteration, one udpating message of the Gibbs sampler will be printed.

incremental_output

TRUE/FALSE. If ⁠incremental_output⁠ is TRUE, an incremental output will be saved. This option should not be enabled unless users anticipate the sampling process will take longer than days.

incremental_output_filename

The filename of the incremental output.

incremental_output_update

An integer. For example, if ⁠incremental_output_update⁠ = 10 then for each 10 iteration, the intermediate result will be updated once.

n_core

The number of cores will be used during the Gibbs sampler. For the Windows operating system, ⁠n_core⁠ must be 1.

Details

The details of the ST-GP model can be found in the vignette. Users can access the vignette using ⁠vignette(package = "MSIMST")⁠.

Value

A list of random quantitiles drawn from the posterior distribution using the Gibbs sampler.

Examples

# Set the random seed.
set.seed(100)

# Simulate the data.
simulated_data <- reg_simulation1(N = 50,
                                  ni_lambda = 8,
                                  beta = c(0.5,0.5,0.5),
                                  beta_b = 1.5,
                                  dsq = 0.1,
                                  sigmasq = 0.5,
                                  delta = 0.6,
                                  nu = 5.89)

y <- simulated_data$y
X <- simulated_data$X

group_info <- c(0,0,0)
# The number of grids (L) for approximating the single index function
L <- 50
N <- length(y)
GP_MCMC_output <- Gibbs_Sampler(X = X,
                                y = y,
                                group_info = group_info,
                                beta_value = c(0.5,0.5,0.5),
                                beta_prior_variance = 10,
                                beta_b_value = 1.5,
                                beta_lambdasq_value = 1,
                                beta_tausq_value = 1,
                                xi_value = abs(rnorm(n = L + 1)),
                                xi_lengthscale_value = 1.0,
                                xi_tausq_value = 1.0,
                                g_func_type = "GP",
                                dsq_value = 1,
                                sigmasq_value = 1,
                                delta_value = 0.6,
                                nu_value = 5.89,
                                U_value = abs(rnorm(N)),
                                S_value = abs(rnorm(N)),
                                loglik_type = "skewT",
                                gof_K = 10,
                                gof_L = 5,
                                iter_warmup = 10,
                                iter_sampling = 20,
                                verbatim = TRUE,
                                update = 10,
                                incremental_output = FALSE,
                                incremental_output_filename = NULL,
                                incremental_output_update = 1e6,
                                n_core = 1)

[Package MSIMST version 1.1 Index]