# prob.psi1

##### A priori probability of psi1, psi2, and theta

Function to determine the a-priori probability of \(\psi_1\) and \(\psi_2\) of the hyperparameters, and \(\theta\), given the apriori means and standard deviations.

Function `sample.theta()`

samples \(\theta\) from its prior distribution.

- Keywords
- array

##### Usage

```
prob.psi1(phi,lognormally.distributed=TRUE)
prob.psi2(phi,lognormally.distributed=TRUE)
prob.theta(theta,phi,lognormally.distributed=FALSE)
sample.theta(n=1,phi)
```

##### Arguments

- phi
Hyperparameters

- theta
Parameters

- lognormally.distributed
Boolean variable with

`FALSE`

meaning to assume a Gaussian distribution and`TRUE`

meaning to use a lognormal distribution.- n
In function

`sample.theta()`

, the number of observations to take

##### Details

These functions use package `mvtnorm`

to calculate the
probability density under the assumption that the PDF is lognormal.
One implication would be that `phi$psi2.apriori$mean`

and `phi$psi1.apriori$mean`

are the means of the
**logarithms** of the elements of `psi1`

and `psi2`

(which are thus assumed to be positive). The `sigma`

matrix is
the covariance matrix of the logarithms as well.

In these functions, interpretation of argument `phi`

depends on
the value of Boolean argument `lognormally.distributed`

. Take
`prob.theta()`

as an example. If `lognormally.distributed`

is `TRUE`

, then `log(theta)`

is normally distributed with
mean `phi$theta.aprior$mean`

and variance
`phi$theta.apriori$sigma`

. If `FALSE`

, `theta`

is
normally distributed with mean `phi$theta.aprior$mean`

and
variance `phi$theta.apriori$sigma`

.

Interpretation of `phi$theta.aprior$mean`

depends on the value of
`lognormally.distributed`

: if `TRUE`

it is the expected
value of `log(theta)`

; if `FALSE`

, it is the expectation of
`theta`

.

The reason that `prob.theta`

has a different default value for
`lognormally.distributed`

is that some elements of `theta`

might be negative, contraindicating a lognormal distribution

##### References

M. C. Kennedy and A. O'Hagan 2001.

*Bayesian calibration of computer models*. Journal of the Royal Statistical Society B, 63(3) pp425-464M. C. Kennedy and A. O'Hagan 2001.

*Supplementary details on Bayesian calibration of computer models*, Internal report, University of Sheffield. Available at http://www.tonyohagan.co.uk/academic/ps/calsup.psR. K. S. Hankin 2005.

*Introducing BACCO, an R bundle for Bayesian analysis of computer code output*, Journal of Statistical Software, 14(16)

##### See Also

##### Examples

```
# NOT RUN {
data(toys)
prob.psi1(phi=phi.toy)
prob.psi2(phi=phi.toy)
prob.theta(theta=theta.toy,phi=phi.toy)
sample.theta(n=4,phi=phi.toy)
# }
```

*Documentation reproduced from package calibrator, version 1.2-8, License: GPL-2*