title: add pointwise confidence interval to prediction of survival curve plot
body: <p>I have a data set of patients on a waiting list for an organ transplant. Event is death time. The set containts the following variables: patientID, time, status , age, gender, bmi, disease. I made a model of the survival time of a patient on the waiting list as function of the covariates age, gender, bmi and disease by using accelerated failure time models, in which the baseline distribution was given by a Lognormal distribution. </p>
  
  <pre><code>fitLog &lt;- survreg(Surv(time, status)~age+gender+bmi+disease, dist = "lognormal", data = patients)
  </code></pre>
  
  <p>Now, I need to give a prediction of the survival curve for a male Fibrosis (disease = 2) patient of age 60 and bmi of 23 and I also need to add a pointwise confidence interval to this curve.</p>
  
  <pre><code>new_data &lt;- with(patients, data.frame(gender = c(1),
                                    age = c(60),
                                    bmi = c(23),
                                    disease = c(2)))
  
  plot(predict(fitLog, newdata=new_data, type="quantile", p=seq(.01,.99,by=.01)), seq(.99,.01,by=-.01), col="red", type="l", xlab = "Time (days)", ylab = "Survival probability (%)", main="Survival time")
  </code></pre>
  
  <p>So when I run this code, I get my prediction model, but now I have to add a pointwise confidence interval to this plot. How do I have to do this? I already tried conf.type but that didn't do anything.</p>
  
  <p>Edit: I used the following code to calculate and plot the confidence intervals:</p>
  
  <pre><code>pred &lt;- predict(fitLog, newdata=new_data, 
  type="quantile",p=seq(.01,.99,by=.01), se=TRUE)
  
  plot(pred$fit - 1.96*pred$se.fit, seq(.99,.01,by=-.01),col="red", type="l", 
  lty=2, xlab = "Time (days)", ylab = "Survival probability (%)", 
  main="Survival time")
  
  lines(pred$fit + 1.96*pred$se.fit,seq(.99,.01,by=-.01),col="red", type="l", 
  lty=2)
  
  lines(predict(fitLog, newdata=new_data, 
  type="quantile",p=seq(.01,.99,by=.01)),seq(.99,.01,by=-.01),col="red", 
  type="l")
  </code></pre>
  
  <p>So now I can plot the confidence interval, but the question is now how to make the dotted line continue until the end of the follow up?</p>
  
  <p><a href="https://i.stack.imgur.com/N9Gsw.png" rel="nofollow noreferrer">image of the plot</a></p>