Fit a survival model using either a semi-parametric approach (penalized likelihood with an approximation of the hazard function by linear combination of M-splines) or a parametric approach (specifying a Weibull distribution on the hazard function). Left-truncated, right-censored, and interval-censored data are allowed.
shr(
formula,
data,
eps = c(5, 5, 3),
n.knots = 7,
knots = "equidistant",
CV = FALSE,
kappa = 10000,
conf.int = 0.95,
maxiter = 200,
method = "Weib",
print.iter = FALSE,
na.action = na.omit
)
regression parameters.
vector containing the log-likelihood without and with covariate.
Weibull parameters.
number of subjects.
number of covariates.
number of events.
model response: Hist
or Surv
object.
integer equal to 1 when the model converged, 2, 3 or 4 otherwise.
times for which survival and hazard functions have been evaluated for plotting.
matched values of the hazard function.
lower confidence limits for hazard function.
upper confidence limits for hazard function.
matched values of the survival function.
lower confidence limits for survival function.
upper confidence limits for survival function.
vector of relative risks.
variance-covariance matrix.
standard errors.
knots of the M-splines estimate of the hazard function.
number of knots.
a binary variable equals to 1 when search of the smoothing parameter kappa by approximated cross-validation, 1 otherwise. The default is 0.
number of iterations.
vector containing the convergence criteria.
observations deleted if missing values.
a formula object with the response on the left hand side
and the terms on the right hand side. The
response must be a survival object or Hist object as returned by
the 'Surv'
or 'Hist'
function.
a data frame in which to interpret the variables named
in the formula
.
a vector of length 3 for the convergence criteria
(criterion for parameters, criterion for likelihood, criterion for
second derivatives). The default is c(5,5,3)
and corresponds to
criteria equals to 10^{-5}
, 10^{-5}
and 10^{-3}
.
Argument only active for the penalized likelihood approach method="splines"
.
Number of knots for the splines to use to approximate
the hazard function. The default is 7. If knots
are given as a vector this argument is ignored.
The algorithm needs least 5 knots and at most 20 knots.
Argument only active for the penalized likelihood approach method="splines"
.
There are three ways to control the placement of the knots between the smallest and the largest
of all time points:
knots="equidistant"
Knots are placed with same distance on the time scale.
knots="quantiles"
Knots are placed such that the number of observations is roughly the same between knots.
List of length 3. The list elements are the actual placements (timepoints) of the knots for the M-spline.
The algorithm reuqires at least 5 knots and allows no more than 20 knots.
binary variable equals to 1 when search (by approximated cross validation) of the smoothing parameter kappa and 0 otherwise. Argument for the penalized likelihood approach. The default is 0.
Argument only active for the penalized likelihood approach method="splines"
.
A positive number (smoothing parameter)
If CV=1 the value is used as a starting value
for a cross validation search to optimize kappa
.
Level of confidence pointwise confidence intervals of the survival and hazard functions, i.e.,
a value between 0 and 1, the default is 0.95
.
The default is also used when conf.int=TRUE
.
To avoid computation of confidence intervals, set conf.int
to FALSE or NULL.
maximum number of iterations. The default is 200.
type of estimation method: "Splines" for a penalized
likelihood approach with approximation of the hazard function by
M-splines, "Weib" for a parametric approach with a Weibull
distribution on the hazard function. Default is "Weib"
.
boolean parameter. Equals to TRUE
to print
the likelihood during the iteration process, FALSE
otherwise. Default is FALSE
. This option is not running on
Windows.
how NAs are treated. The default is first, any na.action attribute of data, second a na.action setting of options, and third 'na.fail' if that is unset. The 'factory-fresh' default is na.omit. Another possible value is NULL.
R: Celia Touraine celia.touraine@icm.unicancer.fr Fortran: Pierre Joly Pierre.Joly@isped.u-bordeaux2.fr
The estimated parameters are obtained using the robust Marquardt algorithm (Marquardt, 1963) which is a combination between a Newton-Raphson algorithm and a steepest descent algorithm.
D. Marquardt (1963). An algorithm for least-squares estimation of nonlinear parameters. SIAM Journal of Applied Mathematics, 431-441.
shr
, print.shr
,
summary.shr
, print.shr
,
# Weibull survival model
library(prodlim)
data(testdata)
fit.su <- shr(Hist(time=list(l,r),id)~cov,data=testdata)
fit.su
summary(fit.su)
# \donttest{
shr.spline <- shr(Hist(time=list(l,r),id)~cov,data=testdata,method="splines",n.knots=6)
shr.spline
shr.spline.q <- shr(Hist(time=list(l,r),id)~cov,data=testdata,
method="splines",n.knots=6,knots="quantiles")
plot(shr.spline.q)
## manual placement of knots
shr.spline.man <- shr(Hist(time=list(l,r),id)~cov,data=testdata,method="splines",knots=seq(0,7,1))
# }
Run the code above in your browser using DataLab