Hazard estimation using cubic splines to approximate the log-hazard function and special functions to allow non-polynomial shapes in both tails.
heft(data, delta, penalty, knots, leftlin, shift, leftlog,
rightlog, maxknots, mindist, silent = TRUE)
An object of class
heft
, which is organized to serve as input for plot.heft
,
summary.heft
, dheft
(density), hheft
(hazard rate), pheft
(probabilities), qheft
(quantiles), and rheft
(random numbers).
The object is a list with the following members:
vector of the locations of the knots in the heft
model.
the k
-th element is the log-likelihood of the fit with k
knots.
coefficients of the knot part of the spline. The k-th coefficient is the coefficient of \((x-t(k))^3_+\). If a coefficient is zero the corresponding knot was considered and then deleted from the model.
coefficients of the polynomial part of the spline. The first element is the constant term and the second element is the linear term.
coefficients of the logarithmic terms. The first element equals
leftlog
and the second element equals rightlog
.
the penalty that was used.
parameter used in the definition of the log terms.
the sample size.
the standard errors of thetal
.
the largest element of data.
vector indicating whether a model of this dimension was not fit (2), fit during the addition stage (0) or during the deletion stage (1).
vector of observations. Observations may or may not be right censored. All observations should be nonnegative.
binary vector with the same length as data
. Elements of data
for which the corresponding element of delta
is 0 are assumed to be
right censored, elements of data
for which the corresponding element of delta
is 1 are assumed to be
uncensored. If delta
is missing, all observations are assumed to be uncensored.
the parameter to be used in the AIC criterion. The method chooses
the number of knots that minimizes -2 * loglikelihood + penalty * (dimension)
.
The default is to use penalty = log(samplesize)
as in BIC. The effect of
this parameter is summarized in summary.heft
.
ordered vector of values, which forces the method to start with these knots.
If knots
is not specified, a default knot-placement rule is employed.
if leftlin
is TRUE
an extra basis-function, which is linear to the left
of the first knot, is included in the basis.
If any of data
is exactly 0, the default of leftlin
is TRUE
,
otherwise it is FALSE
.
parameter for the log terms. Default is quantile(data[delta == 1], .75)
.
coefficient of \(\log \frac x{x + \mbox{shift}}\), which must be greater than
-1
.
(In particular, if leftlog
equals zero no
\(\log \frac x{x + \mbox{shift}}\) term
is included.) If leftlog
is missing its maximum likelihood estimate is used.
If any of data
is exactly zero, leftlog
is
set to zero.
coefficient of \(\log (x + \mbox{shift})\), which must be greater than
-1
.
(In particular, if leftlog
equals zero no
\(\log (x + \mbox{shift})\) term
is included.)
If rightlog
is missing its maximum likelihood estimate is used.
maximum number of knots allowed in the model (default is
\(4*n^{0.2})\), where \(n\) is the length of
data
.
minimum distance in order statistics between knots. The default is 5.
suppresses the printing of diagnostic output about knots added or deleted, Rao-statistics, Wald-statistics and log-likelihoods.
Charles Kooperberg clk@fredhutch.org.
Charles Kooperberg, Charles J. Stone and Young K. Truong (1995). Hazard regression. Journal of the American Statistical Association, 90, 78-94.
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.
hare
,
plot.heft
,
summary.heft
,
dheft
,
hheft
,
pheft
,
qheft
,
rheft
.
fit1 <- heft(testhare[,1], testhare[,2])
# modify tail behavior
fit2 <- heft(testhare[,1], testhare[,2], leftlog = FALSE, rightlog = FALSE,
leftlin = TRUE)
fit3 <- heft(testhare[,1], testhare[,2], penalty = 0) # select largest model
Run the code above in your browser using DataLab