# Using the Weibull Accelerated Failure Time Regression Model to Predict Time to Health Events
## 10 Calculating the 95% Confidence Interval of the Predicted Time
If we use SAS software (SAS (SAS Institute Inc., Cary, NC, USA)), we can directly obtain the variance-covariance matrix of \(\hat{\beta}\) and \(\hat{\sigma}\) by using the following statements:  
proc lifereg data= larynx order=data COVOUT outest=est;  class stage;  model time=death(0)=stage age/dist=weibull;  run;  proc print data=est;  run; The column vector on the right side of \(\Sigma_{\hat{\sigma}\hat{\beta}}\) in Equation (26) can be calculated as follows:  
\[ \begin{pmatrix}(\log 2)^{\hat{\sigma}}\exp(\mathbf{x^{\prime}\hat{\beta}})\\ (\log 2)^{\hat{\sigma}}\exp(\mathbf{x^{\prime}\hat{\beta}})*stage2\\ (\log 2)^{\hat{\sigma}}\exp(\mathbf{x^{\prime}\hat{\beta}})*stage3\\ (\log 2)^{\hat{\sigma}}\exp(\mathbf{x^{\prime}\hat{\beta}})*stage4\\ (\log 2)^{\hat{\sigma}}\exp(\mathbf{x^{\prime}\hat{\beta}})*age\\ (\log 2)^{\hat{\sigma}}\log(\log 2)\exp(\mathbf{x^{\prime}\hat{\beta}})\end{pmatrix} \] \[= \begin{pmatrix}(\log 2)^{0.885}\exp(3.5288-0.1477*1-0.5866*0-1.54 41*0-0.0175*74)\\ (\log 2)^{0.885}\exp(3.5288-0.1477*1-0.5866*0-1.5441*0-0.0175*74)*1\\ (\log 2)^{0.885}\exp(3.5288-0.1477*1-0.5866*0-1.5441*0-0.0175*74)*0\\ (\log 2)^{0.885}\exp(3.5288-0.1477*1-0.5866*0-1.5441*0-0.0175*74)*0\\ (\log 2)^{0.885}\exp(3.5288-0.1477*1-0.5866*0-1.5441*0-0.0175*74)*0\\ (\log 2)^{0.885}\log(\log 2)\exp(3.5288-0.1477*1-0.5866*0-1.5441*0-0.0175*74) \\ (\log 2)^{0.885}\log(\log 2)\exp(3.5288-0.1477*1-0.5866*0-1.5441*0-0.0175*74) \\ \end{pmatrix} \] \[= \begin{pmatrix}5.8383\\ 5.8383\\ 0\\ 432.03\\ -7.7915\end{pmatrix} \]Now, with all the necessary components in place, we can calculate the standard error of the median survival time:  
\[SE =\left\{\begin{array}{l}\left( \begin{array}{c}5.8383\\ 5.8383\\ 0\\ 432.03\\ -7.7915\end{array} \right)^{t}\left( \begin{array}{cccccccc}0.817&-0.0905&-0.0 848&-0.0444&-0.0111&0.0229\\ -0.090&0.1661&0.0532&0.0507&0.00057&0.00014\\ -0.0859&0.0532&0.1024&0.0567&0.00042&-0.0065\\ 0&-0.044&0.0507&0.0567&0.1320&-0.00020&-0.0095\\ -0.011&0.00057&0.0004&-0.00020&0.00016&-0.00023\\ -7.7915\end{array} \right)\right\}^{1}\] \[=2.156133\]  
This calculation yields a standard error of approximately \(2.156133\). Consequently, the 95% confidence interval for the median survival time is given by:  
\[95\%CI:(5.83-1.96*2.16<Median_{46}<5.83+1.96*2.16)=(1.60\text{ to }10.01)\text{ months}.\]  
which means we are 95% confident that the survival time will be within 1.60 to 10.01 months. Alternatively, we can employ the built-in R function _predict_ to estimate the median survival time as follows:  
Median46\(<\)-predict(wr, newdata=data.frame(stage=2,age=74),type=\"quantile\", p=0.5,se.fit=TRUE) Median46 This results in:  
$fit 5.838288 $se.fit 2.095133 The standard error differs slightly from our calculations because R uses [PERSON]'s formula to calculate the standard error of the survival function [11]. Note that in R's built-in _predict_ function for the Weibull AFT model, type = \"response\" calculates \(\exp(x^{\prime}\mathbf{\beta})\) without considering \(\Gamma(1+\sigma)\) and type = \"lp\" computes \(x^{\prime}\mathbf{\beta}\) only; thus, we should not use them to predict MTTF. Additionally, to the best of our knowledge, there is no available software for calculating the minimum prediction error survival time.