Skip to content

gaussian error propagation

2 messages · Bernhard Reiter, Martin Maechler

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

not for me, see below
Have you accidentally redefined D() to be something else?
2 * x
language 2 * x
[1] 2 4 6
Bernhard>  And so does derive (that is, for the
    Bernhard> gradients; this time x and y set to integer
    Bernhard> values, as R complains about failing objects
    Bernhard> otherwise), when, i.e., I do
    >> eval(derive(expression(x*y), c("x","y")))

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

    Bernhard> Greetings, Ockham

    Bernhard> ______________________________________________
    Bernhard> R-help at stat.math.ethz.ch mailing list
    Bernhard> https://stat.ethz.ch/mailman/listinfo/r-help
    Bernhard> PLEASE do read the posting guide!
    Bernhard> http://www.R-project.org/posting-guide.html