bayesr: Generic model fitting function for Bayesian regression models

Usage Arguments Details Value Author(s) References Examples

View source: R/BayesR.R

Usage

1
2
3
4
5
6
7
8
bayesr(formula, family = gaussian.BayesR,
  data = NULL, knots = NULL, weights = NULL, subset = NULL,
  offset = NULL, na.action = na.fail, contrasts = NULL,
  reference = NULL, parse.input = parse.input.bayesr,
  transform = transformJAGS, setup = setupJAGS,
  sampler = samplerJAGS, results = resultsJAGS,
  cores = NULL, sleep = NULL, combine = TRUE,
  model = TRUE, ...)

Arguments

formula

symbolic description of the model (of type y ~ x), also see formula.gam and s.

family

family object specifying the distribution and link to use in fitting etc.?

data

a data.frame or list containing the model response variable and covariates required by the formula. By default the variables are taken from environment(formula): typically the environment from which bayesx is called.

knots

see function gam.

weights

prior weights on the data.

subset

an optional vector specifying a subset of observations to be used in the fitting process.

offset

can be used to supply a model offset for use in fitting.

na.action

a function which indicates what should happen when the data contain NA's. The default is set by the na.action setting of options, and is na.omit if set to NULL.

contrasts

an optional list. See the contrasts.arg of model.matrix.default.

reference

character or integer. The reference category for categorical response models.

parse.input

function, used to parse all input parameters, see function parse.bayesr.input.

transform

function, a transformator function to be applied on smooth term objects.

setup

MCMC setup function or named list controlling arguments of the default setup function.

sampler

MCMC sampler function or named list controlling arguments of the default MCMC sampler function.

results

function, a function that computes the desired results from MCMC samples and data.

cores

integer. How many cores should be used? The default is one core if cores = NULL. If cores > 1, the return value is again a list of class "bayesr", for which all plotting and extractor functions can be applied, see argument chains. Note that this option is not available on Windows systems, see the documentation of function mclapply.

sleep

numeric, when using the multiple core option, sleep determines the waiting time until the next process is started.

combine

logical, should samples from different chains/cores already be combined within bayesr?

model

should the model frame be returned?

...

arguments passed to setup, sampler, results.

Details

...

Value

...

Author(s)

Nikolaus Umlauf, Stefan Lang, Achim Zeileis.

References

...

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: ## generate some data
set.seed(111)
n <- 200

## regressor
dat <- data.frame(x = runif(n, -3, 3))

## response
dat$y <- with(dat, 1.5 + sin(x) + rnorm(n, sd = 0.6))

## estimate model
b <- bayesr(y ~ s(x), data = dat)

## plot fitted model term
plot(b)

## End(Not run)

BayesR documentation built on May 2, 2019, 6:16 p.m.