[R] Calculating with tolerances (error propagation)

Keith Jewell k.jewell at campden.co.uk
Thu Sep 9 17:06:00 CEST 2010

"Jan private" <jrheinlaender at gmx.de> wrote in message 
news:1284029454.2740.361.camel at localhost.localdomain...
> Hello Bernardo,
> ---------
> If I understood  your problem this script solve your problem:
> q<-0.15 + c(-.1,0,.1)
> h<-10 + c(-.1,0,.1)
> 5*q*h
> [1]  2.475  7.500 12.625
> ---------
> OK, this solves the simple example.
> But what if the example is not that simple. E.g.
> P = 5 * q/h
> Here, to get the maximum tolerances for P, we need to divide the maximum
> value for q by the minimum value for h, and vice versa. Is there any way
> to do this automatically, without thinking about every single step?
> There is a thing called interval arithmetic (I saw it as an Octave
> package) which would do something like this.
> I would have thought that tracking how a (measuring) error propagates
> through a complex calculation would be a standard problem of
> statistics?? In other words, I am looking for a data type which is a
> number with a deviation +- somehow attached to it, with binary operators
> that automatically knows how to handle the deviation.
> Thank you,
> Jan
Ahhh! "tracking how a (measuring) error propagates through a complex 

That doesn't depend only on values+errors, it also depends on the 
calculations, so - as you imply - you'd have to define a new data type and 
appropriate methods for all the mathematical operators (not just the binary 
ones!). Not a trivial task!

If you don't already know it, you should look at  "Evaluation of measurement 
data - Guide to the expression of uncertainty in measurement" 
especially section 5.

Hope that helps,

Keith J

More information about the R-help mailing list