logspline density using splines to approximate the log-density
using
the 1992 knot deletion algorithm (oldlogspline).
The 1997 algorithm using knot
deletion and addition is available using the logspline function.oldlogspline(uncensored, right, left, interval, lbound,
ubound, nknots, knots, penalty, delete = TRUE)uncensored or interval must be specified.lbound = 0. However, if the density is
essedelete = TRUE) or to fit a
density with nknots knots (delete = FALSE). The method has an automatic rule
for selecting nknots if this parameter is not specified.delete = TRUE)
or to fit a density with these knots delete = FALSE). Overrules nknots<-2 * loglikelihood + penalty * (number of knots - 1).
The default is to use a penalty parameter of penalty = log(samplesize) oldlogspline, that is intended as input for
plot.oldlogspline,
summary.oldlogspline,
doldlogspline (densities),
poldlogspline (probabilities),
qoldlogspline (quantiles),
roldlogspline (random numbers from the fitted distribution).The object has the following members:
oldlogspline model.
oldlbound was $-\inf$ 1 it was something else; second
element: lbound, if specified; third element: 0 - ubound was $\inf$,
1 it was something else; fourth element: ubound, if specified.k-th element is the log-likelihood of the fit with k+2 knots.Charles J. Stone, Mark Hansen, Charles Kooperberg, and Young K. Truong. The use of polynomial splines and their tensor products in extended linear modeling (with discussion) (1997). Annals of Statistics, 25, 1371--1470.
logspline,
oldlogspline,
plot.oldlogspline,
summary.oldlogspline,
doldlogspline,
poldlogspline,
qoldlogspline,
roldlogspline.# A simple example
y <- rnorm(100)
fit <- oldlogspline(y)
plot(fit)
# An example involving censoring and a lower bound
y <- rlnorm(1000)
censoring <- rexp(1000) * 4
delta <- 1 * (y <= censoring)
y[delta == 0] <- censoring[delta == 0]
fit <- oldlogspline(y[delta == 1], y[delta == 0], lbound = 0)Run the code above in your browser using DataLab