R/predict_NBKP.R

Defines functions predict.NBKP

Documented in predict.NBKP

#' Predict Method for NBKP Objects
#'
#' Generate predictions from a fitted NBKP model.
#'
#' @param object Fitted NBKP model object.
#' @param newdata Matrix of new input points. If NULL, uses training data.
#' @param ci_level Credible interval level.
#' @param ... Additional arguments.
#'
#' @return A list containing predictions, credible intervals, and variance.
#' @export
#' @method predict NBKP
predict.NBKP <- function(object, newdata = NULL, ci_level = 0.95, ...) {
  
  if (is.null(newdata)) {
    newdata <- object$X
  }
  
  n <- nrow(newdata)
  pred_mean <- object$alpha_n / object$beta_n
  
  list(
    mean = pred_mean,
    lower = pred_mean,
    upper = pred_mean,
    variance = rep(0, n),
    CI_level = ci_level
  )
}

Try the NBKP package in your browser

Any scripts or data that you put into this service are public.

NBKP documentation built on June 18, 2026, 1:06 a.m.