Learn R Programming

BACCO (version 1.0-50)

phi.fun.toy: Functions to create or change hyperparameters

Description

Function to create (phi.fun.toy) or modify (phi.change) toy hyperparameters $\phi$ in a form suitable for passing to the other functions in the library.

The user should never make $\phi$ by hand; always use one of these functions.

Usage

phi.fun.toy(rho, lambda, psi1, psi1.apriori, psi2, psi2.apriori,
  theta.apriori, power)
phi.change(phi.fun, old.phi = NULL, rho = NULL, lambda = NULL,
          psi1 = NULL, psi1.apriori=NULL,  psi1.apriori.mean=NULL,  psi1.apriori.sigma=NULL,
          psi2 = NULL, psi2.apriori=NULL,  psi2.apriori.mean=NULL,  psi2.apriori.sigma=NULL,
                      theta.apriori=NULL, theta.apriori.mean=NULL, theta.apriori.sigma=NULL,
          power=NULL)

Arguments

phi.fun
In phi.change(), the name of the function that creates the hyperparameters. Use phi.fun.toy() for the toy dataset
old.phi
In function phi.change(), the hyperparameter object $\phi$ to be modified
rho
Correlation hyperparameter appearing in main equation
lambda
Noise hyperparameter
psi1
Roughness lengths hyperparameter for design matrix D1. Internal function pdm.maker.psi1() takes psi1 as an argument and returns omega_x, omega_t and sigma1squared.
psi1.apriori
A priori PDF for $\psi_1$. In the form

of a two element list with first element (mean) the mean and second element (sigma) the covariance matrix; distribution of the logarithms is assumed to be multivariate normal.

psi1.apriori.mean
In function phi.change.toy(), use this argument to change just the mean of psi1 (and leave the value of sigma unchanged)
psi1.apriori.sigma
In function phi.change.toy(), use this argument to change just the variance matrix of psi1
psi2
Roughness lengths hyperparameter for D2.

Internal function pdm.maker.psi2() takes psi2 as an argument and returns omegastar_x and sigma2squared. In phi.fun.toy(), t

psi2.apriori
A priori PDF for $\psi_2$ and hyperparameters $\rho$ and $\lambda$ (in that order). As for psi1.apriori, this is in the form of a list with the first element (mean) the mean and second eleme
psi2.apriori.mean
In phi.change.toy(), use to change just the mean of psi2
psi2.apriori.sigma
In phi.change.toy(), use to change just the variance matrix of psi2
theta.apriori
Apriori PDF for $\theta$. As above, in the form of a list with elements for the mean and covariance. The distribution is multivariate normal (NB: The distribution is multivariate normal and NOT lognormal! To be explicit: $\log(\theta)$
theta.apriori.mean
In phi.change.toy(), use to change just the mean of theta
theta.apriori.sigma
In phi.change.toy(), use to change just the variance matrix of theta
power
Exponent of the exponential as passed to corr.matrix() (and thence to corr()) of package emulator. For the general case of nondiagonal positive.definite.matrix, the metric is $e^{-\left| (x

Value

  • Returns a list of several elements:
  • rhoCorrelation hyperparameter
  • lambdaNoise hyperparameter
  • psi1Roughness lengths hyperparameter for D1
  • psi1.aprioriApriori mean and variance matrix for psi1
  • psi2Roughness lengths hyperparameter for D2
  • psi2.aprioriApriori mean and variance matrix for psi2
  • theta.aprioriApriori mean and variance matrix for the parameters
  • powerPower for use in the correlation matrix
  • omega_xPositive definite matrix for the lat/long part of D1, whose diagonal is psi1[1:2]
  • omega_tPositive definite matrix for the code parameters theta, whose diagonal is psi1[3:5]
  • omegastar_xPositive definite matrix for use in equation 13 of the supplement; represents distances between rows of D2
  • sigma1squaredvariance
  • sigma2squaredvariance
  • omega_x.upperUpper triangular Cholesky decomposition for omega_x
  • omega_x.lowerLower triangular Cholesky decomposition for omega_x
  • omega_t.upperUpper triangular Cholesky decomposition for omega_t
  • omega_t.lowerLower triangular Cholesky decomposition for omega_t
  • aPrecalculated matrix for use in Edash.theta(...,fast.but.opaque=TRUE)
  • bPrecalculated matrix for use in Edash.theta(...,fast.but.opaque=TRUE)
  • cPrecalculated scalar for use in ht.fun(...,fast.but.opaque=TRUE)
  • APrecalculated scalarfor use in tt.fun()
  • A.upperUpper triangular Cholesky decomposition for A
  • A.lowerLower triangular Cholesky decomposition for A

Details

Note that this toy function contains within itself pdm.maker.toy() which extracts omega_x and omega_t and sigma1squared from psi1. This will need to be changed for real-world applications. Earlier versions of the package had pdm.maker.toy() defined separately.

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.shef.ac.uk/~st1ao/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)

See Also

toys, H1.toy

Examples

Run this code
phi.fun.toy(100,101,1:6,list(mean=rep(1,6),sigma=1+diag(6)),50:55,
list(mean=rep(0,4),sigma=0.1+diag(4)),
list(mean=0.1+(1:3),sigma=2.1+diag(3)),
2)

phi.fun.toy(rho=1,
lambda=1,
psi1          = structure(c(1.1, 1.2, 1.3, 1.4,1.5,0.7), .Names = c("x", "y", "A","B", "C","s1sq")),
psi1.apriori  = list(mean=rep(0,6),sigma=0.4+diag(6)),psi2=structure(c(2.1, 2.2), .Names = c("x","y")),
psi2.apriori  = list(mean=rep(0,5),sigma=0.2+diag(5)),
theta.apriori = list(mean=0.1+(1:3),sigma=2.1+diag(3)),
power=2)

data(toys)
phi.change(phi.fun=phi.fun.toy, old.phi = phi.toy, rho = 100)
phi.change(phi.fun=phi.fun.toy, old.phi = phi.toy, theta.apriori.sigma = 4*diag(3))

identical(phi.toy, phi.change(phi.fun=phi.fun.toy, old.phi=phi.toy))

Run the code above in your browser using DataLab