Learn R Programming

polspline (version 1.1.25)

heft: Heft: hazard estimation with flexible tails

Description

Hazard estimation using cubic splines to approximate the log-hazard function and special functions to allow non-polynomial shapes in both tails.

Usage

heft(data, delta, penalty, knots, leftlin, shift, leftlog,
rightlog, maxknots, mindist, silent = TRUE)

Value

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:

knots

vector of the locations of the knots in the heft model.

logl

the k-th element is the log-likelihood of the fit with k knots.

thetak

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.

thetap

coefficients of the polynomial part of the spline. The first element is the constant term and the second element is the linear term.

thetal

coefficients of the logarithmic terms. The first element equals leftlog and the second element equals rightlog.

penalty

the penalty that was used.

shift

parameter used in the definition of the log terms.

sample

the sample size.

logse

the standard errors of thetal.

max

the largest element of data.

ad

vector indicating whether a model of this dimension was not fit (2), fit during the addition stage (0) or during the deletion stage (1).

Arguments

data

vector of observations. Observations may or may not be right censored. All observations should be nonnegative.

delta

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.

penalty

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.

knots

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.

leftlin

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.

shift

parameter for the log terms. Default is quantile(data[delta == 1], .75).

leftlog

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.

rightlog

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.

maxknots

maximum number of knots allowed in the model (default is \(4*n^{0.2})\), where \(n\) is the length of data.

mindist

minimum distance in order statistics between knots. The default is 5.

silent

suppresses the printing of diagnostic output about knots added or deleted, Rao-statistics, Wald-statistics and log-likelihoods.

Author

Charles Kooperberg clk@fredhutch.org.

References

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.

See Also

hare, plot.heft, summary.heft, dheft, hheft, pheft, qheft, rheft.

Examples

Run this code
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