Exch: Specify an exchangeable prior.

View source: R/SpecPrior-generators.R

ExchR Documentation

Specify an exchangeable prior.

Description

Specify a prior for main effects or interactions in which the units are exchangeable. Units are exchangeable if the labels or ordering of the units does not provide any information about their distribution.

Usage

Exch(covariates = NULL, error = Error())

Arguments

covariates

An object of class Covariates or NULL (the default). If covariates is NULL, the prior does not include covariates.

error

An object of class Error.

Details

The prior specified by Exch has the form

parameter[j] = covariates[j] + error[j].

Including a covariates term can make the assumption of exchangeability more plausible. For instance, treating regional effects as exchangeable is more plausible after the region effects have been adjusted for differences in regions' incomes and population sizes. A covariates term can be specified using function Covariates.

Errors can have a normal or t distribution. The error term is specified using function Error.

Value

An object of class SpecExch.

See Also

ExchFixed specifies a simpler exchangeable prior. DLM specifies a non-exchangeable prior.

Examples

Exch()
Exch(error = Error(robust = TRUE))
Exch(error = Error(scale = HalfT(scale = 0.5)))

## with covariates
data <- data.frame(region = letters[1:10],
                   income = rnorm(10))
Exch(covariates = Covariates(mean ~ income, data = data))

StatisticsNZ/demest documentation built on Nov. 2, 2023, 7:56 p.m.