R/RcppExports.R

Defines functions gibbs_mean gibbs_lm

Documented in gibbs_lm gibbs_mean

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Gibbs Sample for Linear Regression
#'
#' Gibbs sampler for linear regression
#'
#' @param y a vector of response values
#' @param x a matrix of explanatory variables
#' @param steps number of samples to obtain
#' @export
gibbs_lm <- function(y, x, steps = 1000L) {
    .Call(`_iNZightBayes_gibbs_lm`, y, x, steps)
}

#' Gibbs Sample for Single Mean and Variance
#'
#' Gibbs sampler to sample mean and variance of one numeric variable
#'
#' @details
#' Assumes conjugate Normal-Inverse-Gamma priors on mean and variance:
#' \deqn{y \sim \mathrm{Normal}(\mu, \sigma^2)}
#'
#' @param y a vector of values
#' @param steps number of iterations to run Gibbs sampler for
#' @param burnin number of burn-in iterations to discard before proper steps
#' @param thin thinning factor (default 1)
#' @param mu_0 prior mean for mu (default 0)
#' @param sigma2_0 prior variance for mu (default 1e6)
#' @param alpha prior shape parameter for sigma2 (default 1e-3)
#' @param beta prior scale parameter for sigma2 (default 1e-3)
gibbs_mean <- function(y, steps = 1000L, burnin = 1000L, thin = 1L, mu_0 = 0.0, sigma2_0 = 1.0e6, alpha = 1.0e-3, beta = 1.0e-3) {
    .Call(`_iNZightBayes_gibbs_mean`, y, steps, burnin, thin, mu_0, sigma2_0, alpha, beta)
}
iNZightVIT/iNZightBayes documentation built on Dec. 20, 2021, 5:56 p.m.