Given a sample x1,...,xn from a decreasing density f, this code provides a smooth decreasing estimate using regression splines.
The knot choices can be provide by the user or the "default" or automatic choices may be used.
If chosen by the user: The estimate will be over the interval [a,b] where the user-defined knots are at a=t0< t1 < ...< tk< tk+1=b.
The inputs to the code are the sample values and the knots. If knots=0, the default knot values will be used with the mode at the origin.
The outputs are the knots, the value of the criterion function, the values of the density estimate at the observed x-values, and values of the density estimate at a tightly-spaced grid of points for plotting.
Here is some example code where the default knots are chosen.
Given a sample x1,...,xn from a decreasing convex density f on [a,b] and knots a=t0< t1 < ...< tk< tk+1, f is estimated using cubic regression splines
The knot choices can be provide by the user or the "default" or automatic choices may be used.
If chosen by the user: The estimate will be over the interval [a,b] where the user-defined knots are at a=t0< t1 < ...< tk< tk+1=b.
The inputs to the code are the sample values and the knots. If knots=0, the default knot values will be used with the mode at the origin.
The outputs are the knots, the value of the criterion function, the values of the density estimate at the observed x-values, and values of the density estimate at a tightly-spaced grid of points for plotting.
Here is some example code where the default knots are chosen.
Given a sample x1,...,xn from a unimodal density f on [a,b] and mode m, f is estimated using quadratic regression splines. Knots are placed evenly over [a,b], then extra knots are added where the data are "thickest."
Here is some example code.