R/GetUserMeanCurve.R

GetUserMeanCurve <- function (optns, obsGrid, regGrid, buff) {
  # For the case where a user provides a mean function 

  userMu = optns$userMu
  rangeUser <- range(optns$userMu$t)
  rangeObs <- range(obsGrid)
  if( rangeUser[1] > rangeObs[1] + buff || 
      rangeUser[2] < rangeObs[2] - buff   ) {
    stop('The range defined by the user provided mean does not cover the support of the data.')
  }

  mu = spline(userMu$t, userMu$mu, xout= obsGrid)$y
  muDense = spline(obsGrid,mu, xout=regGrid)$y
  bw_mu = NULL
 
  result <- list( 'mu' = mu, 'muDense'= muDense, 'bw_mu' = bw_mu)
  class(result) <- "SMC"
  return(result)
}
functionaldata/tPACE documentation built on Aug. 16, 2022, 8:27 a.m.