R/predict.R

Defines functions predict.linreg

Documented in predict.linreg

#' Predict method for linreg objects
#' 
#' @description Predicted values from an object of the class "linreg".
#' @param object An object of class "linreg", generated by a call to \code{\link{linreg}}.
#' @param ... additional arguments.
#' @return A vector of predicted values.
#' @examples 
#' linreg_obj <- linreg(Petal.Length~Species, datasets::iris)
#' predict(linreg_obj)
#' @export

predict.linreg <- function(object,...){
  y_hat <- as.vector(object$y_hat)
  return(y_hat)
}
hugkn566/Lab4HugoOtto documentation built on Oct. 20, 2020, 2:17 p.m.