R/testASE.R

Defines functions testASE

Documented in testASE

#' testASE function
#'
#' Computes testASE using the predictRegsubsets function. Based on the notes of Dr. Turner.
#' @param object a regsubsets object
#' @param newdata new data for predictions
#' @param test_target target for test data
#' @export


testASE <- function(object, newdata, test_target){
  source("R/predictRegsubsets.R", local = TRUE)
  testASE <- c()
  for(i in seq(1, length(object$bic))){
    predictions <- predict.regsubsets(object = object, newdata = newdata, id = i)
    testASE[i] <- mean((test_target - predictions)^2)
  }
  return(testASE)
}
KThompson0308/RUtilities documentation built on Dec. 8, 2019, 8:30 a.m.