# [R-SIG-Finance] Derivative of a smooth function

Jeff Ryan jeff.a.ryan at gmail.com
Fri Apr 2 15:09:24 CEST 2010

```Please keep in mind this question has absolutely nothing to do with
finance, and therefore needs to instead be directed to R-help.

Thanks in advance for keeping the R-finance list on topic.

Jeff

On Fri, Apr 2, 2010 at 3:36 AM, FMH <kagba2006 at yahoo.com> wrote:
>
> Dear All,
>
> I've been searching for appropriate codes to compute the rate of change and the curvature of  nonparametric regression model whish was denoted by a smooth function but unfortunately don't manage to do it. I presume that such characteristics from a smooth curve can be determined by the first and second derivative operators.
>
> The following are the example of fitting a nonparametric regression model via smoothing spline function from the Help file in R.
>
> #######################################################
> attach(cars)
> plot(speed, dist, main = "data(cars)  &  smoothing splines")
> cars.spl <- smooth.spline(speed, dist)
> lines(cars.spl, col = "blue")
> lines(smooth.spline(speed, dist, df=10), lty=2, col = "red")
> legend(5,120,c(paste("default [C.V.] => df =",round(cars.spl\$df,1)),"s( * , df = 10)"), col = c("blue","red"), lty = 1:2, bg='bisque')
> detach()
>
> #######################################################
>
>
> Could someone please advice me the appropriate way to determine such derivatives on the curves which were fitted by the function above and would like to thank you in advance.
>
> Cheers
> Fir
>
>
>
>
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
>

--
Jeffrey Ryan
jeffrey.ryan at insightalgo.com

ia: insight algorithmics
www.insightalgo.com

```