R/rmse.R

Defines functions rmse

Documented in rmse

#' Root mean squared error
#'
#' Computes the root mean-squared error between \code{y} and \code{yhat}, given
#' by \code{sqrt(mean((y - yhat)^2))}.
#'
#' @param y the realized outcomes
#' @param yhat the predicted outcomes
#'
#' @return Returns the root mean-squared error.
#'
#' @examples
#' 
#' rmse(c(1,1,1), c(1,0,2))
rmse <- function(y, yhat) {
  return(sqrt(mean((y-yhat)^2)))
}

Try the SoftBart package in your browser

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

SoftBart documentation built on June 8, 2025, 9:40 p.m.