Hi Fir,

you can alternatively use local regression, implemented in the package locfit, 
which can also estimate derivatives:

library(locfit)
attach(cars)
# main fit
fit <- locfit( dist ~ speed )
# fit 1st derivative
fitd <- locfit( dist ~ speed , deriv =1)
# plots...
plot(speed, dist )
lines(fit)
lines(fitd, col="red")


Hope this helps,

Julien

On Fri, Apr 2, 2010 at 2:06 PM, FMH <kagba2...@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-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to