V.fun {calibrator} | R Documentation |
Variance matrix for observations
Description
Determines the variance/covariance matrix for the observations and code run points.
Usage
V.fun(D1, D2, H1, H2, extractor,
E.theta, Edash.theta, give.answers=FALSE, test.for.symmetry=FALSE, phi)
Arguments
D1 |
Matrix of code run points |
D2 |
Matrix of observation points |
H1 |
Regression function for |
H2 |
Regression function for |
extractor |
Function to extract |
Edash.theta |
Function to return expectation of |
E.theta |
Expectation of |
give.answers |
Boolean (defaulting to |
test.for.symmetry |
Boolean with Set this argument to |
phi |
Hyperparameters |
Details
See KOH2001 for full details on page 3 of the supplement
Value
If give.answers
is the default value of FALSE
,
returns a matrix of covariances for use in p.page4()
.
If give.answers
is TRUE
, returns a named list of (currently)
17 elements. Elements one to six are lines one to six respectively from
page 3 of the supplement; subsequent lines give intermediate steps in
the calculation. The final element is the matrix is the covariances
as returned when give.answers
is FALSE
.
Note
This function takes a long time to run
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)
See Also
Examples
data(toys)
(jj <-V.fun(D1=D1.toy, D2=D2.toy, H1=H1.toy, H2=H2.toy,
extractor=extractor.toy,
Edash.theta=Edash.theta.toy,
E.theta=E.theta.toy, phi=phi.toy))
## Now note that V.fun() changes with the PRIOR used for theta:
phi.different.theta <- phi.change(old.phi=phi.toy,
theta.apriori.mean=c(100,100,100),phi.fun=phi.fun.toy)
V.fun(D1=D1.toy, D2=D2.toy, H1=H1.toy, H2=H2.toy,
extractor=extractor.toy,
Edash.theta=Edash.theta.toy,
E.theta=E.theta.toy, phi=phi.different.theta)
## different!
## Now compare jj above with V.fun() calculated with
## different phi2:
phi.toy.new <- phi.change(phi.fun=phi.fun.toy, old.phi = phi.toy, psi2=c(8,8,8))
V.fun(D1=D1.toy, D2=D2.toy, H1=H1.toy, H2=H2.toy,
extractor=extractor.toy,
Edash.theta=Edash.theta.toy,
E.theta=E.theta.toy, phi=phi.toy.new)
## different!
## Not run:
data(toys)
set.seed(0)
jj <- create.new.toy.datasets(D1=D1.toy , D2=D2.toy)
y.toy <- jj$y.toy
z.toy <- jj$z.toy
d.toy <- jj$d.toy
v.fun <- function(...){V.fun(D1=D1.toy, D2=D2.toy, H1=H1.toy, H2=H2.toy,
extractor=extractor.toy, Edash.theta=Edash.theta.toy,
E.theta=E.theta.toy, phi=phi.toy, give=TRUE)}
Rprof(file="~/f.txt");ignore <- v.fun();Rprof(file=NULL)
system("cd ; R CMD Rprof ~/f.txt > ~/ff.txt")
## End(Not run)