Skip to contents

Sampling posterior distributions of parameters in a GLM

Function to perform sampling as well as methods to investigate results

mcmcglm()
Efficient Gibbs sampling of posterior distribution of parameters in GLM

Methods for mcmcglm objects

Methods to explore results - data of samples and function for creating trace plot

coef(<mcmcglm>)
S3 method for getting the average value of coefficients
quantile(<mcmcglm>)
S3 method for getting quantiles of samples for each parameter
samples()
Get the drawn samples from the object
trace_plot()
Create a trace plot of the MCMC samples

Tuning parameters of slice sampling

Functions for getting a list of results across tuning parameter values and plotting them

mcmcglm_across_tuningparams()
Get list of mcmcglms run across values of slice sampling tuning parameters
plot_mcmcglm_across_tuningparams()
Plot a list of mcmcglms showing varying tuning parameters in the title of the plots

Tools for investigating computation time for different methods

A function which returns a data frame of computation time for different specifications and method for plotting results

compare_eta_comptime_across_nvars()
Compare runtime using CGGibbs and naive approach to calculate linear predictor
plot_eta_comptime()
Plot the results of compare_eta_comptime_across_nvars

Calculating the log-potential

Utilities for calculating the log-potential as a function of a new coordinate of parameter vector in order to perform slice sampling within Gibbs

log_density()
S3 generic for calculating the log density of a distribution dispatched via a family
log_likelihood()
Calculate log likelihood parametrised by "mu"
update_linear_predictor()
Update value of a linear predictor as function of a single coordinate change
log_potential_from_betaj()
Calculate the log-potential (log-likelihood plus log-density of prior)