coxed
This function uses bootstrapping to create standard errors and
confidence intervals for the quantities produced by the coxed()
function. It is adapted from the bootcov
function
in the rms
package. It is called by the coxed
function and is not intended to be used by itself. Please refer to
the original bootcov
function for general bootstrapping
applications.
bootcov2(fit, cluster, B = 200, fitter, coef.reps = TRUE,
loglik = FALSE, pr = FALSE, maxit = 15, group = NULL,
stat = NULL)
an estimated Cox proportional hazards model object with class "coxph" or "cph"
a variable indicating groupings. cluster
may
be any type of vector (factor, character, integer). Unique values
of cluster
indicate possibly correlated groupings of observations.
Note the data used in the fit and stored in fit$x
and fit$y
may have had observations containing missing values deleted. It is assumed
that if there were any NA
s, an naresid
function exists for
the class of fit. This function restores NA
s so that the rows of
the design matrix coincide with cluster
Number of bootstrap simulation iterations
the name of a function with arguments (x,y)
that will fit
bootstrap samples. Default is taken from the class of fit if it is ols
,
lrm
, cph
, psm
, Rq
. If fitter="tvc"
the
function employs agreg.fit
set to TRUE
if you want to store a matrix of all
bootstrap regression coefficient estimates in the returned component boot.Coef
.
set to TRUE
to store -2 log likelihoods for each bootstrap model,
evaluated against the original x
and y
data. The default is to do this when
coef.reps
is specified as TRUE
. The use of loglik=TRUE
assumes
that an oos.loglik
method exists for the type of model being analyzed, to calculate
out-of-sample -2 log likelihoods (see rmsMisc
). After the B -2 log likelihoods
(stored in the element named boot.loglik
in the returned fit object), the B+1
element is the -2 log likelihood for the original model fit
set to TRUE
to print the current sample number to monitor progress
maximum number of iterations, to pass to fitter
a grouping variable used to stratify the sample upon bootstrapping. This
allows one to handle k
-sample problems, i.e., each bootstrap sample will be forced
to select the same number of observations from each level of group as the number appearing
in the original dataset. You may specify both group
and cluster
a single character string specifying the name of a stats
element produced
by the fitting function to save over the bootstrap repetitions. The vector of saved statistics
will be in the boot.stats
part of the list returned by bootcov
This function contains the same code as the bootcov
function in
the rms
package, with a few alterations to work better with the coxed
function. First, we output a result attribute b.ind
, which contains the observation numbers from the estimation sample
that are drawn with replacement to produce the bootstrap sample and takes into account clustering.
Second, we program a new class, tvc
, for
fitter
to use agreg.fit
instead of coxph.fit
when the data contain time-varying covariates.