#' 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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.