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 |
Details
The input is either a (multivariate) variable x
with a normal distribution,
or a joint distribution consisting of a Gamma- or ExpGamma-distributed
variable y
, and conditionally on this a (multivariate) normally
distributed x
. The output is a joint distribution for (z,x)
or
(z,x,y)
, where the marginal distribution for x
or (x,y)
is
unchanged, while the conditional distribution for z
given x
or (x,y)
is (multivariate) normal. The expectation and precision for
this conditional distribution is X\mu
and P\tau
, respectively.
Here, \mu
is the expectation of x
, while X
is the
optional second argument. The matrix P
is the optional third argument,
while \tau
is either equal to y
, when y
has a Gamma distribution,
or equal to e^{-2y}
, when y
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
Examples
prior <- normalgamma()
full <- linearpredict(prior, rep(1, 7))
data <- simulate(normal(), 7)
posterior <- conditional(full, 1:7, data)
plot(posterior)