# Using the Weibull Accelerated Failure Time Regression Model to Predict Time to Health Events
## 10 Calculating the 95% Confidence Interval of the Predicted Time  
First, we used Equation (21) to calculate the standard error of the survival time:  
\[SE = \left\{ \begin{pmatrix}\frac{\partial\left(\log 2\right)^{\phi} \exp\left(x_{i}^{\prime}\hat{\beta}\right)}{\partial\hat{\beta}}\\ \frac{\partial\left(\log 2\right)^{\phi}\exp\left(x_{i}^{\prime}\hat{\beta} \right)}{\partial\hat{\beta}}\end{pmatrix} ^{t}\Sigma_{\hat{\rho}\hat{\rho}} \left(\frac{\partial\left(\log 2\right)^{\phi}\exp\left(x_{i}^{\prime}\hat{\beta} \right)}{\partial\hat{\beta}}\right)\right\}^{\frac{1}{2}} \tag{26}\] \[= \left\{ \begin{pmatrix}\frac{\partial\left(\log 2\right)^{\phi} \exp\left(x_{i}^{\prime}\hat{\beta}\right)}{\partial\hat{\beta}}\\ \frac{\partial\left(\log 2\right)^{\phi}\exp\left(x_{i}^{\prime}\hat{\beta} \right)}{\partial\hat{\beta}}\end{pmatrix} ^{t}\Sigma_{\hat{\rho}\hat{\rho}} \left(\frac{\partial\left(\log 2\right)^{\phi}\exp\left(x_{i}^{\prime}\hat{\beta} \right)}{\partial\hat{\beta}}\right)\right\}^{\frac{1}{2}}\] \[= \left\{ \begin{pmatrix}\frac{\left(\log 2\right)^{\phi} \exp\left(x^{\prime}\hat{\beta}\right)}{\left(\log 2\right)^{\phi}\exp\left(x^{\prime} \hat{\beta}\right)*stage2}\\ \left(\log 2\right)^{\phi}\exp\left(x^{\prime}\hat{\beta}\right)*stage3\\ \left(\log 2\right)^{\phi}\exp\left(x^{\prime}\hat{\beta}\right)*stage4\\ \left(\log 2\right)^{\phi}\exp\left(x^{\prime}\hat{\beta}\right)*age5\\ \left(\log 2\right)^{\phi}\log\left(\log 2\right)\exp\left(x^{\prime}\hat{\beta} \right)\end{pmatrix} ^{t}\Sigma_{\hat{\rho}\hat{\rho}}\left(\frac{\left(\log 2 \right)^{\phi}\exp\left(x^{\prime}\hat{\beta}\right)}{\left(\log 2\right)^{\phi}\exp \left(x^{\prime}\hat{\beta}\right)*stage2}\right)\\ \left(\log 2\right)^{\phi}\exp\left(x^{\prime}\hat{\beta}\right)*stage4\\ \left(\log 2\right)^{\phi}\exp\left(x^{\prime}\hat{\beta}\right)*age5\\ \left(\log 2\right)^{\phi}\log\left(\log 2\right)\exp\left(x^{\prime}\hat{\beta} \right)\end{pmatrix}^{\frac{1}{2}}\]  
The variance-covariance matrix \(\Sigma_{\hat{\rho}\hat{\rho}}\) can be calculated by the observed Fisher information of the Weibull AFT model. In most statistical software, this variance-covariance matrix can be computed directly. In R, we used the following R code to obtain the \(\Sigma_{\hat{\rho}\hat{\rho}}\)matrix:  
```
wr$var
```  
which produces the following: \[\text{ (Intercept) }\text{ }\text{stage2 stage3 stage4 age Log(scale)}\] \[\text{ (Intercept)  
\(log(\hat{\sigma})\) back to \(\hat{\sigma}\). Some extra calculations were needed. To make this adjustment, we can refer to the formulas found on page 401 of [PERSON]'s book [10]. Our calculations were:  
\[Cov(\beta_{0},\sigma_{,}) =Cov(\beta_{0},e^{\log(\sigma)})=Cov(\beta_{0},\log(\sigma))*\sigma=0.02292735\] \[Cov(\beta_{1},\sigma_{,}) =Cov(\beta_{1},e^{\log(\sigma)})=Cov(\beta_{1},\log(\sigma))*\sigma= 0.0001403178\] \[Cov(\beta_{2},\sigma_{,}) =Cov(\beta_{2},e^{\log(\sigma)})=Cov(\beta_{2},\log(\sigma))*\sigma -0.006469443\] \[Cov(\beta_{3},\sigma_{,}) =Cov(\beta_{3},e^{\log(\sigma)})=Cov(\beta_{3},\log(\sigma))*\sigma =-0.009470604\] \[Cov(\beta_{4},\sigma_{,}) =Cov(\beta_{4},e^{\log(\sigma)})=Cov(\beta_{4},\log(\sigma))*\sigma =-0.0002297781\] \[Cov(\sigma)=Cov(e^{\log(\sigma)})=(e^{\log(\sigma)})^{2}Cov( \log(\sigma))=\sigma^{2}Var(log(\sigma))=0.0117501\]  
We replaced the last row of our variance-covariance matrix from R with these six values:  
[,1] [,2] [,3] [,4] [,5] [,6]  
[1,] 0.817 -0.09049 -0.08479 -0.0444 -0.01114 0.02293  
[2,] -0.090 0.16611 0.05319 0.0507 0.00057 0.00014  
[3,] -0.085 0.05319 0.10237 0.0567 0.00042 -0.00647  
[4,] -0.044 0.05068 0.05668 0.1320 -0.00020 -0.00947  
[5,] -0.011 0.00057 0.00042 -0.0002 0.00016 -0.00023  
[6,] 0.023 0.00014 -0.00647 -0.0095 -0.00023 0.01175  
which is the \(\Sigma_{\hat{\sigma}\hat{\beta}}\) matrix needed to calculate the standard error in Equation (26).