sigmahatsquared           package:emulator           R Documentation

_E_s_t_i_m_a_t_o_r _f_o_r _s_i_g_m_a _s_q_u_a_r_e_d

_D_e_s_c_r_i_p_t_i_o_n:

     Returns maximum likelihood estimate for sigma squared.  The "'.A'"
     form does not need 'Ainv', thus removing the need to invert 'A'. 
     Note that this form is _slower_ than the other if 'Ainv' is known
     in advance, as 'solve(.,.)' is slow.

_U_s_a_g_e:

     sigmahatsquared(H, Ainv, d)
     sigmahatsquared.A(H, A, d)

_A_r_g_u_m_e_n_t_s:

       H: Regressor matrix (eg as returned by 'regressor.multi()')

       A: Correlation matrix (eg 'corr.matrix(val)')

    Ainv: Inverse of the correlation matrix (eg
          'solve(corr.matrix(val))')

       d: Vector of observations

_A_u_t_h_o_r(_s):

     Robin K. S. Hankin

_R_e_f_e_r_e_n_c_e_s:

     J. Oakley and A. O'Hagan, 2002. "Bayesian Inference for the
     Uncertainty Distribution of Computer Model Outputs", Biometrika
     89(4), pp769-784

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

_E_x_a_m_p_l_e_s:

     ## First, set sigmasquared to a value that we will try to estimate at the end:
     REAL.SIGMASQ <- 0.3

     ## First, some data:
     val <- latin.hypercube(100,6)
     H <- regressor.multi(val,func=regressor.basis)

     ## now some scales:
      fish <- c(1,1,1,1,1,4)

     ## A and Ainv
     A <- corr.matrix(as.matrix(val),scales=fish,power=2)
     Ainv <- solve(A)

     ## a real relation; as used in helppage for interpolant:
     real.relation <- function(x){sum( (1:6)*x )}

     ## use the real relation:
     d <- apply(val,1,real.relation)

     ## now add some Gaussian process noise:
     d.noisy <-  as.vector(rmvnorm(n=1,mean=d, REAL.SIGMASQ*A))

     ## now estimate REAL.SIGMASQ:
     sigmahatsquared(H,Ainv,d.noisy)

     ## That shouldn't be too far from the real value specified above.

     ## Finally, a sanity check:
     sigmahatsquared(H,Ainv,d.noisy) - sigmahatsquared.A(H,A=A,d.noisy)

