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 Hi, 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 https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
how to take derivatives of a step function
3 messages · Bill Venables, Eugene Salinas (R), Peter Dalgaard
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 Hi, 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 https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
"Eugene Salinas (R)" <r-eugenesalinas at comcast.net> writes:
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.
Kernel smoothing. Look in e.g. Andersen,Borgan,Gill,Keiding: Statistical Models Based on Counting Processes (1992, Springer), p. 230++
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