[R] how to take derivatives of a step function

Bill.Venables@csiro.au Bill.Venables at csiro.au
Fri Jan 23 07:09:53 CET 2004

It might be helpful to know just why you want to do this.  Just because one
function is a smooth approximation to another doesn't imply anything about
the derivatives approximating each other, (well, not much).

The GENERALIZED derivative of a step function can be written down explicitly
as the weighted sum of dirac delta functions - in other words it's zero
'almost everywhere' but goes crazy at the steps.

Bill Venables.

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Eugene Salinas (R)
Sent: Friday, 23 January 2004 2:54 PM
To: r-help at stat.math.ethz.ch
Subject: [R] how to take derivatives of a step function


I have estimated a step function and need to take the derivatives of 
this function at all points in the range. Does anyone know of any clever 
ways to do this?

(I have already tried to fit a polynomial through the points in order to 
obtain a smooth representation and then take derivatives of this. Also 
tried to smooth it, and used an SG differentiator. Results are rather 
poor so far, in the sense that you can see from the graph that the 
derivative function is a straight line but I am getting pretty wavy 
things back.)

thanks for any advice, eugene.

R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide!

More information about the R-help mailing list