weibfit {MCPModBC} | R Documentation |
Computes different estimators for the censored Weibull regression model
Description
Computes the maximum likelihood estimators (MLE) for the censored Weibull regression model. The bias-corrected estimators based on the Cox and Snell's and Firth's methods also are available. In addition, for the covariance matrix the corrected estimators discussed in Magalhaes et al. 2021 also are available.
Usage
weibfit(formula, data, L = Inf, estimator = "MLE",
corrected.var = FALSE)
Arguments
formula |
A formula that contains on the left hand side an object of the type Surv and on the right hand side the covariates definition |
data |
A data.frame in which the formula argument can be evaluated |
L |
the prefixed censoring times. |
estimator |
the class of estimator used: MLE (maximum likelihood estimator, by default), BCE (bias-corrected estimator based on the Cox and Snell's method) and Firth (bias-corrected estimator based on the Firth's method). |
corrected.var |
should the covariance-corrected estimator be used? (FALSE by default). See details. |
Details
The Weibull distribution considered here has probability density function
f(t;\lambda, \sigma)=\frac{1}{\sigma
\lambda^{1/\sigma}}t^{1/\sigma-1}\exp\left\{-\left(\frac{t}{\lambda}\right)^{1/\sigma}\right\},
\quad t, \sigma, \lambda>0.
The regression structure is incorporated as
\log(\lambda_i)={\bm x}_i^\top {\bm \beta}, \quad i=1,\ldots,n.
For
the computation of the bias-corrected estimators, \sigma
is assumed as
fixed in the jackknife estimator based on the traditional MLE.
The Fisher information matrix for \bm \beta
is given by {\bm
K}=\sigma^{-2} {\bm X}^\top {\bm W} {\bm X}
, where {\bm X}=({\bm
x}_1,\ldots,{\bm x}_n)^\top
, {\bm W}=\mbox{diag}(w_1,\ldots,w_n)
, and
w_i=E\left[\exp\left(\frac{y_i-\log
\lambda_i}{\sigma}\right)\right]=q \times \left\{ 1 - \exp\left[
-L_i^{1/\sigma} \exp(-\mu_i/\sigma) \right] \right\} + (1-q)\times
\left(r/n\right),
with q = P\left(W_{(r)}\leq \log L_i\right)
and
W_{(r)}
denoting the r
th order statistic from W_1, \ldots,
W_n
, with q=1
and q=0
for types I and II censoring,
respectively. (See Magalhaes et al. 2019 for details).
The bias-corrected maximum likelihood estimator based on the Cox and Snell's
method (say \widetilde{\bm \beta}
) is based on a corrective approach
given by \widetilde{\beta}=\widehat{\beta}-B(\widehat{\beta})
, where
B({\bm \beta})= - \frac{1}{2 \sigma^3} {\bm P} {\bm Z}_d \left({\bm
W} + 2 \sigma {\bm W}^{\prime}\right) {\bm 1},
with {\bm P} = {\bm
K}^{-1} {\bm X}^{\top}
, {\bm Z} = {\bm X} {\bm K}^{-1} {\bm
X}^{\top}
, {\bm Z}_d
is a diagonal matrix with diagonal given by the
diagonal of {\bm Z}
, {\bm W}^{\prime} =
diag(w_1^{\prime},
\ldots, w_n^{\prime})
, w_i^{\prime} = - \sigma^{-1} L_i^{1/\sigma}
\exp\{ -L_i^{1/\sigma} \exp(-\mu_i/\sigma) - \mu_i/\sigma \}
and {\bm
1}
is a n
-dimensional vector of ones.
The bias-corrected maximum likelihood estimator based on the Firth's method
(say \check{\bm \beta}
) is based on a preventive approach, which is
the solution for the equation {\bm U}_{{\bm \beta}}^{\star} = {\bm 0}
,
where
{\bm U}_{{\bm \beta}}^{\star} = {\bm U}_{{\bm \beta}} - {\bm
K}_{{\bm \beta} {\bm \beta}} B({\bm \beta}).
The covariance correction is based on the general result of Magalhaes et al. 2021 given by
\mbox{{\bf Cov}}_{\bm 2}^{\bm \tau}({\bm
\beta}^{\star}) = {\bm K}^{-1} + {\bm K}^{-1} \left\{ {\bm \Delta} + {\bm
\Delta}^{\top} \right\} {\bm K}^{-1} + \mathcal{O}(n^{-3})
where
{\Delta} = -0.5 {\Delta}^{(1)} + 0.25 {\Delta}^{(2)} + 0.5 \tau_2
{\Delta}^{(3)}
, with
\Delta^{(1)} = \frac{1}{\sigma^4} {\bm
X}^{\top} {\bm W}^{\star} {\bm Z}_{d} {\bm X},
\Delta^{(2)} = -
\frac{1}{\sigma^6} {\bm X}^{\top} \left[ {\bm W} {\bm Z}^{(2)} {\bm W} - 2
\sigma {\bm W} {\bm Z}^{(2)} {\bm W}^{\prime} - 6 \sigma^2 {\bm W}^{\prime}
{\bm Z}^{(2)} {\bm W}^{\prime} \right] {\bm X},
and
\Delta^{(3)} =
\frac{1}{\sigma^5} {\bm X}^{\top} {\bm W}^{\prime} {\bm W}^{\star\star} {\bm
X},
where {\bm W}^{\star} =
diag(w_1^{\star}, \ldots,
w_n^{\star})
, w_i^{\star} = w_i (w_i -2) - 2 \sigma w_i^{\prime} +
\sigma \tau_1 (w_i^{\prime} + 2 \sigma w_i^{\prime\prime})
, {\bm
Z}^{(2)} = {\bm Z} \odot {\bm Z}
, with \odot
representing a direct
product of matrices (Hadamard product), {\bm W}^{\star\star}
is a
diagonal matrix, with {\bm Z} ( {\bm W} + 2 \sigma {\bm W}^{\prime})
{\bm Z}_{d} {\bm 1}
as its diagonal, {\bm W}^{\prime\prime} =
diag(w_1^{\prime\prime}, \ldots, w_n^{\prime\prime})
,
w_i^{\prime\prime} = - \sigma^{-1} w_i^{\prime} \left[ L_i^{1/\sigma}
\exp(-\mu_i/\sigma) - 1 \right]
, {\bm \tau} = (\tau_1, \tau_2) = (1,
1)
indicating the second-order covariance matrix of the MLE {\bm
\beta}^{\star} = \widehat{{\bm \beta}}
denoted by \mbox{{\bf
Cov}}_{\bm 2}(\widehat{{\bm \beta}})
and {\bm \tau} = (0, -1)
indicating the second-order covariance matrix of the BCE {\bm
\beta}^{\star} = \widetilde{{\bm \beta}}
denoted by \mbox{{\bf
Cov}}_{\bm 2}(\widetilde{{\bm \beta}})
.
Value
coefficients |
a vector with the estimated coefficients for
|
var |
a matrix with the estimated covariance matrix
for the estimates of the regression coefficients |
scale |
the estimated scale parameter |
loglik |
the
value for the logarithm of the likelihood function evaluated in the
estimates of |
linear.predictors |
a
vector with the estimated linear predictor |
y |
a vector with the observed times (possibly censored) |
estimator |
the estimator used for |
corrected.var |
logical. TRUE if a correction for the covariance was used, FALSE otherwise. |
Author(s)
Gallardo D.I., Diniz, M.A., Magalhaes, T.M.
References
Cox, D.R., Snell E.J. A general definition of residuals Journal of the Royal Statistical Society. Series B (Methodological). 1968;30:248-275.
Diniz, Márcio A. and Gallardo, Diego I. and Magalhães, Tiago M. (2023). Improved inference for MCP-Mod approach for time-to-event endpoints with small sample sizes. arXiv <doi.org/10.48550/arXiv.2301.00325>
Firth, D. Bias reduction of maximum likelihood estimates Biometrika. 1993;80:27-38.
Magalhaes Tiago M., Botter Denise A., Sandoval Monica C. A general expression for second- order covariance matrices - an application to dispersion models Brazilian Journal of Probability and Statistics. 2021;35:37-49.
Examples
require(survival)
set.seed(2100)
##Generating covariates
n=20;
x<-runif(n, max=10)
lambda<-exp(1.2-0.5*x); sigma<-1.5
##Drawing T from Weibull model and fixing censoring at 1.5
T<-rweibull(n, shape=1/sigma, scale=lambda); L<-rep(1.5, n)
##Defining the observed times and indicators of failure
y<-pmin(T,L);
delta<-ifelse(T<=L, 1, 0)
data=data.frame(y=y, delta=delta, x=x)
##Fitting for Weibull regression model
##Traditional MLE with corrected variance
ex1=weibfit(Surv(y,delta)~x, data=data, L=L, estimator="MLE",
corrected.var=TRUE)
summary(ex1)
##BCE without corrected variance
ex2=weibfit(Surv(y,delta)~x, data=data, L=L, estimator="BCE",
corrected.var=FALSE)
summary(ex2)
##BCE with corrected variance
ex3=weibfit(Surv(y,delta)~x, data=data, L=L, estimator="BCE",
corrected.var=TRUE)
summary(ex3)
##Firth's correction without corrected variance
ex4=weibfit(Surv(y,delta)~x, data=data, L=L, estimator="BCE",
corrected.var=FALSE)
summary(ex4)