logspline
density using splines to approximate the log-density
using
the 1997 knot addition and deletion algorithm (logspline
).
The 1992 algorithm is available using the oldlogspline
function.logspline(x, lbound, ubound, maxknots = 0, knots, nknots = 0, penalty,
silent = TRUE, mind = -1)
oldlogspline
can deal with right- left- and interval-censored data.lbound = 0
. However, if the density is
esseknots
is not specified, a default knot-placement rule is employed.nknots
knots.
The method has an automatic rule
for selecting nknots
if this parameter is not specified.-2 * loglikelihood + penalty * (number of knots - 1)
.
The default
is to use a penalty parameter of penalty = log(samplesize)
logspline
, that is intended as input for
plot.logspline
(summary plots),
summary.logspline
(fitting summary),
dlogspline
(densities),
plogspline
(probabilities),
qlogspline
(quantiles),
rlogspline
(random numbers from the fitted distribution).The object has the following members:
k
-th element is the coefficient
of $(x-t(k))^3_+$ (where $x^3_+$ means the positive part of the third power
of $x$,
and $t(k)$ means knot k
).logspline
model.maxknots = 6
the maximum number of knots is 5).lbound
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.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.
plot.logspline
,
summary.logspline
,
dlogspline
,
plogspline
,
qlogspline
,
rlogspline
,
oldlogspline
.y <- rnorm(100)
fit <- logspline(y)
plot(fit)
# as (4 == length(-2, -1, 0, 1, 2) -1), this forces these initial knots,
# and does no knot selection
fit <- logspline(y, knots = c(-2, -1, 0, 1, 2), maxknots = 4, penalty = 0)
Run the code above in your browser using DataLab