Learn R Programming

iemisc (version 0.5.0)

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.

encoding

UTF-8

Details

Relative error is expressed as

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

[object Object],[object Object],[object Object]

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
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