prior {bayesplay} R Documentation

Specify a prior

Description

Define priors using different different distribution families

Usage

prior(family, ...)

Arguments

 family the prior distribution (see details) ... see details

Details

Available distribution families

The following distributions families can be used for the prior

• normal a normal distribution

• student_t a scaled and shifted t-distribution

• cauchy a Cauchy distribution

• uniform a uniform distribution

• point a point

• beta a beta distribution The parameters that need to be specified will be dependent on the family

Normal distribution

When family is set to normal then the following parameters may be be set

• mean mean of the normal prior

• sd standard deviation of the normal prior

• range (optional) a vector specifying the parameter range

Student t distribution

When family is set to student_t then the following parameters may be set

• mean mean of the scaled and shifted t prior

• sd standard deviation of the scaled and shifted t prior

• df degrees of freedom of the scaled and shifted t prior

• range (optional) a vector specifying the parameter range

Cauchy distribution

When family is set to cauchy then the following parameters may be set

• location the centre of the Cauchy distribution (default: 0)

• scale the scale of the Cauchy distribution

• range (optional) a vector specifying the parameter range

Uniform distribution

When family is set to uniform then the following parameters must be set

• min the lower bound

• max the upper bound

Point

When family is set to point then the following parameters may be set

• point the location of the point prior (default: 0)

Beta

When family is set to beta then the following parameters may be set

• alpha the first shape parameter

• beta the second shape parameter

Value

an object of class prior

Examples

# specify a normal prior
prior(family = "normal", mean = 0, sd = 13.3)

# specify a half-normal (range 0 to Infinity) prior
prior(family = "normal", mean = 0, sd = 13.3, range = c(0, Inf))

# specify a student t prior
prior(family = "student_t", mean = 0, sd = 13.3, df = 79)

# specify a truncated t prior
prior(family = "student_t", mean = 0, sd = 13.3, df = 79, range = c(-40, 40))

# specify a cauchy prior
prior(family = "cauchy", location = 0, scale = .707)

# specify a half cauchy prior
prior(family = "cauchy", location = 0, scale = 1, range = c(-Inf, 0))

# specify a uniform prior
prior(family = "uniform", min = 0, max = 20)

# specify a point prior
prior(family = "point", point = 0)

# specify a beta prior
prior(family = "beta", alpha = 2.5, beta = 3.8)

[Package bayesplay version 0.9.2 Index]