Skip to content

AW: [R] numericDeriv and ecdf

4 messages · Khamenia, Valery, Brian Ripley, Thomas Lumley +1 more

#
wait, you misunderstood me!

I'd like to see 10 or 9 points with estimated values of 
*numerical* derivatives according to ecdf output. 
And that's it.

Now look into output of numericDerivative in my example:

[1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
attr(,"gradient")
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
 [1,]    0    0    0    0    0    0    0    0    0     0
 [2,]    0    0    0    0    0    0    0    0    0     0
 [3,]    0    0    0    0    0    0    0    0    0     0
 [4,]    0    0    0    0    0    0    0    0    0     0
 [5,]    0    0    0    0    0    0    0    0    0     0
 [6,]    0    0    0    0    0    0    0    0    0     0
 [7,]    0    0    0    0    0    0    0    0    0     0
 [8,]    0    0    0    0    0    0    0    0    0     0
 [9,]    0    0    0    0    0    0    0    0    0     0
[10,]    0    0    0    0    0    0    0    0    0     0

What could you say now?

With kind regards,
Valery A.Khamenya
---------------------------------------------------------------------------
Bioinformatics Department
BioVisioN AG, Hannover
#
An empirical CDF is a step function: it does not have a derivative at the 
jump points, and has a zero derivative everywhere else.

What is this function `numericDerivative': do you mean `numericDeriv'?
If so, it seems to be intended for differentiable functions, and
calculates one-sided derivatives.  In your example the one-sided 
derivatives are all zero.
On Fri, 25 Apr 2003, Khamenia, Valery wrote:

            

  
    
#
On Fri, 25 Apr 2003, Khamenia, Valery wrote:

            
The output of ecdf() is a step function, so mathematically its derivative
is zero except where it is undefined.

Everywhere except the jumps numericDeriv() gives the right answer
Exactly at the jumps the derivative is undefined, so it isn't surprising
that numericDeriv gives the wrong answer.

What result did you want?

	-thomas
#
Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
Also, the call must be wrong, try this:
[1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
attr(,"gradient")
          [,1]
 [1,] -6710886
 [2,] -6710886
 [3,] -6710886
 [4,] -6710886
 [5,] -6710886
 [6,] -6710886
 [7,] -6710886
 [8,] -6710886
 [9,] -6710886
[10,] -6710886

whereas e(x+z) gives you all zeroes. (An option for deciding between
left-sided, right-sided, and central derivates could be a nice
extension, BTW).