[R] gaussian error propagation

Bernhard Reiter ockham at gmx.net
Tue Oct 19 06:54:59 CEST 2004


Dear list,

I'm intending to use R (1.9.0 installed on my linux machine) for my applied
experimental physics course, requiring it to do rather basic statistical
things (like calculation of mean, std-deviation and some linear fitting).
There is, though, a task for which I haven't found a solution for after some
days of search: in experiments involving multiple (supposedly) independent
measurements I am required to calculate the total error according to
Gaussian error propagation law. 
[Sqrt (Sum of (squares of (partials(mean) times corresponding std-dev) ) )]
After failing to find an appropriate function, I've started trying to build
my own (something that takes a (mathematical) function, does the partial
derivations, takes the corresponding mean values and sd's (i.e. from a data
frame) as arguments and does the remaining necessary calculations. 
However, even my most basic experiments with D() and derive() failed, though
I stuck to the derive() help page and the FAQ, but (x and y unspecified,)
typing 
> D(expression(x^2), "x")
yields 0
And so does derive (that is, for the gradients; this time x and y set to
integer values, as R complains about failing objects otherwise), when, i.e.,
I do
> eval(derive(expression(x*y), c("x","y")))

I'd be very glad if anybody could help me with this rather strange behaviour
and tell me if/what I'm doing wrong and if maybe there's an even simpler way
to perform gaussian error propagation.

Greetings,
Ockham




More information about the R-help mailing list