iemisc (version 0.9.8)

relerror: Relative error

Description

This function computes the relative error.

Usage

relerror(xt, xa)

Arguments

xt

numeric vector that contains the true value(s)

xa

numeric vector that contains the approximate value(s)

Value

relative error, as a percent (%), as a numeric vector.

Details

Relative error is expressed as

$$\varepsilon_{t} = \frac{{true \: value} - {approximation}}{true \: value} \cdot 100$$

\(\varepsilon_t\)

the "true percent relative error"

true value

the true value

approximation

the approximate value

References

Steven C. Chapra, Applied Numerical Methods with MATLAB for Engineers and Scientists, Second Edition, Boston, Massachusetts: McGraw-Hill, 2008, page 82-83.

See Also

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.

Examples

Run this code
# NOT RUN {
library("iemisc")
# Example 4.1 from the Reference text (page 83)
relerror(1.648721, 1.5) # answer as a percent (\%)



# }

Run the code above in your browser using DataLab