relerror | R Documentation |
This function computes the relative error.
relerror(xt, xa)
xt |
numeric vector that contains the true value(s) |
xa |
numeric vector that contains the approximate value(s) |
Relative error is expressed as
\varepsilon_{t} = \frac{{true \: value} - {approximation}}{true \: value} \cdot 100
\varepsilon_t
the "true percent relative error"
the true value
the approximate value
relative error, as a percent (%), as a numeric vector
.
Irucka Embry
Steven C. Chapra, Applied Numerical Methods with MATLAB for Engineers and Scientists, Second Edition, Boston, Massachusetts: McGraw-Hill, 2008, page 82-83.
sgm
for geometric mean, shm
for harmonic mean, cv
for
coefficient of variation (CV), rms
for root-mean-square (RMS), approxerror
for approximate error, and ranges
for sample range.
library(iemisc)
# Example 4.1 from the Reference text (page 83)
relerror(1.648721, 1.5) # answer as a percent (\%)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.