gamBayes: Bayesian GAMs

Description Usage Arguments Value Examples

View source: R/gamBayes.R

Description

This implements generalized additive models (GAMs) via the basis functions available in the splines and splines2 packages. For example, you can use bs(), ns(), cSpline(), iSpline(), mSpline(), or the base R function poly() to generate basis functions for the variables intended for non-linear modeling. The basis functions are regularized using a hierarchical prior where the shrinkage parameter for each predictor is given a DuMouchel's prior. Note that predictor specific means for each variable represented by a basis function of n terms, all n terms share a shrinkage parameter. This is standard procedure for GAMs.

Usage

1
2
3
gamBayes(formula, data, family = "gaussian", log_lik = FALSE,
  iter = 4000, warmup = 1000, adapt = 1000, chains = 4, thin = 1,
  method = "rjparallel", cl = makeCluster(2), ...)

Arguments

formula

the model formula

data

a data frame

family

one of "gaussian", "st" (Student-t with nu=3), "binomial", or "poisson".

log_lik

Should the log likelihood be monitored? The default is FALSE.

iter

How many post-warmup samples? Defaults to 4000.

warmup

How many warmup samples? Defaults to 1000.

adapt

How many adaptation steps? Defaults to 1000.

chains

How many chains? Defaults to 4.

thin

Thinning interval. Defaults to 1.

method

Defaults to "rjparallel". Otherwise, "rjags" (single core run).

cl

Use parallel::makeCluster(# clusters) to specify clusters for the parallel methods. Defaults to two cores.

...

Other arguments to run.jags.

df

degrees of freedom for prior.

s

The desired prior scale. Defaults to 1. Is automatically squared within the model so select a number here on the standard deviation scale.

Value

A run.jags object

Examples

1

abnormally-distributed/Bayezilla documentation built on Oct. 31, 2019, 1:57 a.m.