>>>>> "Bernhard" == Bernhard Reiter <ockham at
gmx.net>
>>>>> on Tue, 19 Oct 2004 06:54:59 +0200 writes:
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?
> (dd <- D(expression(x^2), "x"))
2 * x> str(dd)
language 2 * x> x <- 1:3
> eval(dd)
[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