R/getCorrVector.R

#' @title Get Correlation Vector Between New Point and Design Points
#'
#' @description
#' Compute correlations between the points of a mixed continuous and categorical design matrix
#' and a new data point \code{x0} according to a specified correlation function for the continuous
#' variables and a method for constructing cross-correlations between the categorical
#' level-combinations.
#'
#' @param model [\code{\link[=makeCCKriging]{CCKriging}}]\cr
#'   The \code{\link[=makeCCKriging]{CCKriging}} model.
#' @param x0 [\code{data.frame}]\cr
#'   A \code{data.frame} with one row containing the new data point.
#'
#' @return [\code{numeric}]
#' @seealso \code{getCorrMatrix}
#' @export
getCorrVector = function(model, x0) {
  # assertDataFrame(x0)
  # correct.names = testSubset(colnames(model$x), colnames(x0))
  # correct.names = correct.names && testSubset(colnames(x0), colnames(model$x))
  # if (!correct.names)
  #   stop("x0 must have the exact same names like model$x.")
  n = nrow(model$x)
  model2 = model
  model2$x = rbind(model$x, x0)
  return(getCorrMatrix(model2)[n + 1, 1:n])
}
dominikkirchhoff/CCKriging documentation built on May 19, 2019, 4:05 p.m.