[R] how to take derivatives of a step function

Eugene Salinas (R) r-eugenesalinas at comcast.net
Fri Jan 23 15:43:08 CET 2004

Thanks. Here is some more info that may help:

I am estimating a transformation model H(Y)=Xb+e and have obtained (up 
to a location parameter) an estimated of H(T), call it H_est(T). (Its a 
new estimator I am trying out that works with unspecified functional 
forms etc). Now if the model is a proportional hazard model then the 
integrated hazard is given by exp(H_est(T)) and hence the estimated 
hazard is d/dt(exp(H_est(T))).

Thus, I need to figure out how to evaluate this last expression which is 
based on a step function.

thank a lot, matt.

Bill.Venables at csiro.au wrote:

>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