# EK.eqn10.supp

##### Posterior mean of K

Estimates the posterior mean of K as per equation 10 of KOH2001S, section 4.2

- Keywords
- array

##### Usage

```
EK.eqn10.supp(X.dist, D1, D2, H1, H2, d, hbar.fun,
lower.theta, upper.theta, extractor, give.info=FALSE,
include.prior=FALSE, phi, ...)
```

##### Arguments

- X.dist
Probability distribution of

`X`

, in the form of a two-element list. The first element is the mean (which should have name “`mean`

”), and the second element is the variance matrix, which should be a positive definite matrix of the correct size, and have name “var”- D1
Matrix whose rows are the code run points

- D2
Matrix whose rows are field observation points

- H1
Regression function for

`D1`

- H2
Regression function for

`D2`

- d
Vector of code outputs and field observations

- include.prior
Boolean; passed to function

`p.eqn8.supp()`

(qv)- hbar.fun
Function that gives expectation (with respect to

`X`

) of`h1(x,theta)`

and`h2(x)`

as per section 4.2- lower.theta
Lower integration limit for

`theta`

(NB: a vector)- upper.theta
Lower integration limit for

`theta`

(NB: a vector)- extractor
Extractor function; see

`extractor.toy()`

for an example- give.info
Boolean, with default

`FALSE`

meaning to return just the answer and`TRUE`

to return the answer along with all output from both integrations as performed by`adaptIntegrate()`

- phi
Hyperparameters

- ...
Extra arguments passed to the integration function. If multidimensional (ie

`length(theta)>1`

), then the arguments are passed to`adaptIntegrate()`

; if one dimensional, they are passed to`integrate()`

##### Details

This function evaluates a numerical approximation to equation 10 of section 4.2 of the supplement.

Equation 10 integrates over the prior distribution of `theta`

. If
`theta`

is a vector, multidimensional integration is necessary.

In the case of multidimensional integration, function
`adaptIntegrate()`

is used.

In the case of one dimensional integration---theta being a
scalar---function `integrate()`

of the stats package is used.

Note that equation 10 is conditional on the observed data **and**
the hyperparameters

##### Value

Returns a scalar

##### Note

The function was not reviewed by the Journal of Statistical Software.

The package formely used adapt package, but this is no longer available on CRAN. The package now uses the cubature package.

##### 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)

##### Examples

```
# NOT RUN {
1+1
# }
# NOT RUN {
# Not run because it takes R CMD check too long
data(toys)
EK.eqn10.supp(X.dist=X.dist.toy, D1=D1.toy, D2=D2.toy,
H1=H1.toy, H2=H2.toy, d=d.toy,
hbar.fun=hbar.fun.toy, lower.theta=c(-3,-3,-3),
upper.theta=c(3,3,3),extractor=extractor.toy,
phi=phi.toy)
# }
```

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