#' GLMprediction
#'
#' This function takes a trained Generalized Linear Model and returns predictions on the given test set.
#'
#'
#' @param model The fit GLM model to run predictions through.
#' @param test The dataset to make predictions on.
#'
#'
#' @export
GLMprediction <- function(model,test){
preds <- stats::predict(model,test,type='response',se.fit=TRUE)
z <- qnorm(.99)
lower <- preds$fit - z*preds$se.fit
upper <- preds$fit + z*preds$se.fit
dum <- rep("0",length(preds$fit))
dum[preds$fit>.5]="1"
table <- data.frame(Date=test$Date,Team=test$Team,Lo=lower,Avg=preds$fit,Hi=upper,PrWL=dum)
table[3:5] <- round(table[3:5],digits = 3)
return(table)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.