R/L2.R

Defines functions L2

L2 <- function(y, yhat, w){ 
  n <- length(y)
  if (missing(w)) w <- rep(1 / n, n)
  return(stats::weighted.mean((y-yhat)^2, w))
}

Try the cgaim package in your browser

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

cgaim documentation built on June 30, 2025, 9:07 a.m.