Learn R Programming

CaliCo (version 0.1.1)

prior: Generates prior.class objects.

Description

prior is a function that generates a prior.class containing information about one or several priors. When several priors are selected, the function prior returns a list of prior.class.

Usage

prior(type.prior, opt.prior)

Arguments

type.prior

the vector of the prior types selected. For example type.prior=c("gaussian","gamma")

opt.prior

list of the hyperparameters relatives to the prior selected. If the first prior selected is Gaussian, the hyperparameters would be the mean and the standard deviation. See Details for further clarifications.

Value

prior returns a prior.class object. Two main methods are available:

  • print() returns the main information concerning the prior distribution

Details

The densities implemented are defined as follow

  • The Gaussian density: $$f(x)=1/(\sigma*\sqrt(2\pi))exp{-1/2*((x-\mu)/\sigma)^2}$$ where \(\mu\) and \(\sigma\) (the mean and the standard deviation) are the two hyperparameters. The vector \(c(\mu,\sigma^2)\) is the one looked for in opt.prior.

  • The Gamma density: $$f(x)=1/(k^a*\Gamma(a))*x^(a-1)*exp(-(x/k))$$ where \(a\) and \(k\) (the shape and the scale) are the two hyperparameters. The vector \(c(a,k)\) is the one looked for in opt.prior.

  • The Uniform density: $$f(x)=1/(b-a)$$ where \(a\) and \(b\) (the upper and the lower bound) are the two hyperparameters. The vector \(c(a,b)\) is the one looked for in opt.prior.

See Also

model, calibrate, forecast, sequentialDesign

Examples

Run this code
# NOT RUN {
#### Only one prior is wanted
## For a Gaussian Prior
gaussian <- prior(type.prior="gaussian",opt.prior=list(c(0.5,0.001)))
plot(gaussian)

#### For several priors
priors <- prior(type.prior=c("gaussian","gamma"),opt.prior=list(c(0.5,0.001),c(5,1)))
plot(priors$Prior1)
plot(priors$Prior2)
# }

Run the code above in your browser using DataLab