File: percent_bias.Rd

package info (click to toggle)
r-cran-metrics 0.1.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 292 kB
  • sloc: sh: 13; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 1,088 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/regression.R
\name{percent_bias}
\alias{percent_bias}
\title{Percent Bias}
\usage{
percent_bias(actual, predicted)
}
\arguments{
\item{actual}{The ground truth numeric vector.}

\item{predicted}{The predicted numeric vector, where each element in the vector
is a prediction for the corresponding element in \code{actual}.}
}
\description{
\code{percent_bias} computes the average amount that \code{actual} is greater
than \code{predicted} as a percentage of the absolute value of \code{actual}.
}
\details{
If a model is unbiased \code{percent_bias(actual, predicted)} should be close
to zero. Percent Bias is calculated by taking the average of
(\code{actual} - \code{predicted}) / \code{abs(actual)} across all observations.

\code{percent_bias} will give \code{-Inf}, \code{Inf}, or \code{NaN}, if any
elements of \code{actual} are \code{0}.
}
\examples{
actual <- c(1.1, 1.9, 3.0, 4.4, 5.0, 5.6)
predicted <- c(0.9, 1.8, 2.5, 4.5, 5.0, 6.2)
percent_bias(actual, predicted)
}
\seealso{
\code{\link{bias}}
}