R/R2.R

Defines functions R2

Documented in R2

R2 <- function(Y,Ypred)
{
	Ypred <- as.numeric(Ypred)
	Y     <- as.numeric(Y)
	if(length(Ypred)!=length(Y)){
		stop("The entries must have the same length.")
	}
	return(1 - mean((Y-Ypred)^2)/mean((Y-mean(Y))^2))
}

Try the DiceEval package in your browser

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

DiceEval documentation built on July 4, 2022, 9:05 a.m.