linearpredict {lestat}R Documentation

Create a Linear Extension of a Distribution

Description

Extends the given probability distribution with new variables which are (multivariate) normally distributed with parameters based on the values of the given probability distribution and values given to the function.

Usage

linearpredict(object, ...)

Arguments

object

The probability distribution to be extended. Currently, it should be either a (multivariate) normal distribution, or a (multivariate) normal distribution extended with an extra parameter with either a Gamma or an ExpGamma distribution.

...

A second optional argument may be given, which should then be a matrix with the same number of columns as there are normally distributed variables in the input object. If the matrix has only one row or column, it may be given as a vector. The default is a matrix with one row, consisting of only 1's.

A third optional argument may also be given, which is then the precision matrix of the new normally distributed variables. By default, this matrix is the identity. If the input object contains a Gamma-distributed variable, its value is multiplied with the precision matrix. If the input object contains an ExpGamma-distributed variable yy, the value e2ye^{-2y} is multiplied with the precision matrix.

Details

The input is either a (multivariate) variable xx with a normal distribution, or a joint distribution consisting of a Gamma- or ExpGamma-distributed variable yy, and conditionally on this a (multivariate) normally distributed xx. The output is a joint distribution for (z,x)(z,x) or (z,x,y)(z,x,y), where the marginal distribution for xx or (x,y)(x,y) is unchanged, while the conditional distribution for zz given xx or (x,y)(x,y) is (multivariate) normal. The expectation and precision for this conditional distribution is XμX\mu and PτP\tau, respectively. Here, μ\mu is the expectation of xx, while XX is the optional second argument. The matrix PP is the optional third argument, while τ\tau is either equal to yy, when yy has a Gamma distribution, or equal to e2ye^{-2y}, when yy has an ExpGamma distribution.

Value

A multivariate normal, multivariate Normal-Gamma, or multivariate Normal-ExpGamma distribution, depending on the input.

Author(s)

Petter Mostad <mostad@chalmers.se>

See Also

contrast

Examples

prior <- normalgamma()
full  <- linearpredict(prior, rep(1, 7))
data  <- simulate(normal(), 7)
posterior <- conditional(full, 1:7, data)
plot(posterior)

[Package lestat version 1.9 Index]