bcgp_model: Construct a bcgp model

Description Usage Arguments Details Value See Also Examples

View source: R/bcgpFuncs.R

Description

bcgp_model constructs an instance of S4 class bcgpmodel. This object contains information describing the desired Bayesian Composite Gaussian Process (BCGP) model. The bcgpmodel object can then be used to draw samples from the model.

Usage

1
2
3
bcgp_model(x, y, composite = TRUE, stationary = FALSE,
  priors = "default", inits = "random", noise = FALSE,
  algorithm = c("M-H and Gibbs", "Stan"), scaled = TRUE, chains = 4)

Arguments

x

An n x d matrix containing the independent variables in the training set.

y

A vector of length n containing the observed response values in the training set.

priors

Can be either the string "default" or a list containing the values for the prior parameters.

priors = "default" (default): The priors are given default values.

priors via list: Set prior values by providing a list equal in length to the number of Markov chains. A call to createPriors() will assist in the correct creation of this list.

inits

Can be either the string "random" or a list of length chains. The elements of this list should be named lists, where each of these has the name of a parameter and is used to specify the initial values for that parameter for the corresponding chain.

inits = "random" (default): The initial values will be generated randomly from their respective prior distributions.

inits via list: Set initial values by providing a list equal in length to the number of Markov chains. A call to createInits() will assist in the correct creation of this list.

noise

If the data is assumed to be noise-free, then noise should be FALSE. Otherwise, it should be TRUE.

algorithm

One of either "M-H and Gibbs" or "Stan". If "M-H and Gibbs", the sampling algorithm will be a combination of Metropolis-Hastings and Gibbs sampling. If "Stan", the sampling algorithm will be the No-U-Turn sampler implemented by Stan.

scaled

A logical indicating whether the data should be scaled before sampling. TRUE will scale all of the independent variables to [0, 1] and the response variable to have mean zero and unit variance. FALSE will leave the data as is. Scaling the data eases interpretation and sampling. This value should almost always be TRUE. Regardless, predictions will be returned on the original scale.

chains

A positive integer specifying the number of Markov chains. The default is 4. This is here only to assist in the creation of the list of initial values.

Details

This object contains the data, information on the stationarity and whether a composite model is desired or not. A list of priors can either be input or created within this function. It is generally a good idea to run createPriors first to create a correctly-formatted list that can be modified before inputting user-specified priors. A list of initial values can either be input or created within this function. It is generally a good idea to run createInits first to create a correctly-formatted list that can be modified before inputting user-specified initial values.

Value

An object of S4 class bcgpmodel representing the setup for fitting a BCGP model.

See Also

createPriors createInits

Other Major functions: bcgp

Examples

1
2
3
4
x <- matrix(runif(20, 0, 10), nrow = 10, ncol = 2)
y <- x[, 1] + sin(x[, 2])
priors <- createPriors(x, noise = FALSE)
bcgp(x, y, priors)

cbdavis33/bcgp documentation built on Oct. 1, 2019, 8:07 a.m.