Message-ID: <x2ptnasl89.fsf@biostat.ku.dk>
Date: 2003-04-25T14:30:30Z
From: Peter Dalgaard
Subject: AW: [R] numericDeriv and ecdf
In-Reply-To: <Pine.LNX.4.44.0304251423210.12740-100000@gannet.stats>
Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
> 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.
Also, the call must be wrong, try this:
> z <- 0
> numericDeriv(quote(e(x-z)),"z");
[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).
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907