R/errors.R

Defines functions MSE rMSE

Documented in MSE rMSE

#' Ratio mean square error
#'
#' @param x vector of observed values
#' @param y vector of simulated values
#'
#' @keywords internal
#' @rdname error
#' @export
#'
#' @examples
#'
#' rMSE(rnorm(10), rnorm(10))
#'
#' MSE(rnorm(10), rnorm(10))
#'
rMSE <- function(x, y) {

  sum((x/y - 1)^2)/length(y) ## ratio MSE
}


#' @keywords internal
#' @rdname error
#' @export

MSE <- function(x, y) {

  sum((x - y)^2)/length(y) ## ordinary MSE
}

Try the CoSMoS package in your browser

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

CoSMoS documentation built on May 30, 2021, 1:06 a.m.