R/estimate_noise_gp.R

Defines functions estimate_noise_gp

Documented in estimate_noise_gp

#' @title
#' Estimate the standard deviation of the nugget term in standard Gaussian
#' process
#'
#' @description
#' Estimates the standard deviations of the nugget term in standard GP by
#' calculating the standard deviations of the residuals.
#'
#' @param data A vector of outcome data.
#' @param sigma_obs Covariance matrix between observed covariates.
#' @param inv_sigma_obs Inverse of the covariance matrix between observed
#' covariates.
#'
#' @return
#' A scalar of estimated standard deviation of the nugget term in standard GP.
#'
#' @keywords internal
#'
estimate_noise_gp <- function(data, sigma_obs, inv_sigma_obs) {

  noise <- sd(data - arma_mm(sigma_obs - diag(nrow(sigma_obs)),
                               arma_mm(inv_sigma_obs, data)))

  return(noise)
}

Try the GPCERF package in your browser

Any scripts or data that you put into this service are public.

GPCERF documentation built on June 22, 2024, 11:30 a.m.