# betahat.fun.koh: Expectation of beta, given theta, phi and d In RobinHankin/calibrator: Bayesian Calibration of Complex Computer Codes

## Description

Determines the mean of beta, given parameters theta, hyperparameters phi, and the vector of code outputs and observations d. It is named so as to avoid conflict with function `betahat.fun` of package emulator.

## Usage

 ```1 2``` ```betahat.fun.koh(D1, D2, H1, H2, theta, d, phi) betahat.fun.koh.vector(D1, D2, H1, H2, theta, d, phi) ```

## Arguments

 `D1` Matrix whose rows are observation points and parameter values at which the code has been run `D2` Matrix whose rows are the observation points `H1` Regression function for D1 `H2` Regression function for D2 `theta` Parameters `d` Vector of code outputs and observations `phi` Hyperparameters

## Details

This function is defined between equations 2 and 3 of the supplement. It is used in functions `Ez.eqn9.supp()` and `p.eqn8.supp()`.

The user should always use `betahat.fun.koh()`, which is a wrapper for `betahat.fun.koh.vector()`. The forms differ in their treatment of theta. In the former, theta must be a vector; in the latter, theta may be a matrix, in which case `betahat.fun.koh.vector()` is applied to the rows.

In `betahat.fun.koh()`, the rownames are assigned by a kludgy call to `H.fun()`, which itself uses a kludge to determine colnames.

The function returns

betahat(theta)=W(theta) H(theta)^T inv(Vd(theta)) d.

## Author(s)

Robin K. S. Hankin

## References

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

M. 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.ps

R. K. S. Hankin 2005. Introducing BACCO, an R bundle for Bayesian analysis of computer code output, Journal of Statistical Software, 14(16)

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35``` ```data(toys) betahat.fun.koh(theta=theta.toy, d=d.toy, D1=D1.toy, D2=D2.toy, H1=H1.toy, H2=H2.toy, phi=phi.toy) betahat.fun.koh.vector(theta=theta.toy, d=d.toy, D1=D1.toy, D2=D2.toy, H1=H1.toy, H2=H2.toy, phi=phi.toy) ## should be identical jj.theta <- rbind(theta.toy,theta.toy+1,theta.toy+2,theta.toy*0) betahat.fun.koh(theta=jj.theta, d=d.toy, D1=D1.toy, D2=D2.toy, H1=H1.toy, H2=H2.toy, phi=phi.toy) ## Now try with true hyperparameters: phi.true <- phi.true.toy(phi=phi.toy) ## And magically create the REAL parameters: theta.REAL <- create.new.toy.datasets(export=TRUE)\$REAL.PARAMS jj.theta <- rbind(jj.theta, theta.REAL) ## Generate some data: jj <- create.new.toy.datasets(D1.toy , D2.toy) d.toy <- jj\$d.toy ## And finally, observe that the estimated values for beta are pretty ## close to the real values (which omniscient beings can extract using ## reality() and computer.model()): betahat.fun.koh(theta=jj.theta, d=d.toy, D1=D1.toy, D2=D2.toy, H1=H1.toy, H2=H2.toy, phi=phi.true) ## [ ## that is, compare the last column of the above with ## c(computer.model(ex=T)\$REAL.COEFFS, reality(ex=T)\$REAL.BETA2) ## ] ```

RobinHankin/calibrator documentation built on May 8, 2019, 8:06 a.m.