Just a collection of some random cool stuff.
PS. Almost 99% of the contents here are not mine and I don't take credit for them, I reference and copy part of the interesting sections.
Thursday, August 29, 2013
Finding local extrema of a density function using splines
require(graphics)#some data
d <- density(faithful$eruptions, bw ="sj")#make it a time series
ts_y<-ts(d$y)#calculate turning points (extrema)require(pastecs)
tp<-turnpoints(ts_y)#plot
plot(d)
points(d$x[tp$tppos],d$y[tp$tppos],col="red")
No comments:
Post a Comment