# Example of estimating a smooth decreasing convex # density given a sample from an exponential. # The default choice of knots is used. n=100 x=rexp(n) ans=dcspllsq(x,0) plot(c(0,max(ans$xp)),c(0,max(max(ans$tspl),1)),pch="") lines(ans$xp,ans$tspl) lines(ans$xp,exp(-ans$xp),lty=3,col=3) points(x,1:n*0,pch="|",col="slategray") points(ans$knots,1:length(ans$knots)*0,pch="X")