4
$\begingroup$

I often come across hazard ratios and their confidence intervals in the published literature on clinical trials. I would like to calculate the standard deviation from these confidence intervals for some analysis I'll be doing (generating random draws for this hazard ratio from a log-normal distribution).

Having read on this over the past few days, my thought process is that to convert the confidence intervals of a hazard ratio to the standard deviation of that hazard ratio, I would do the following:

  1. Take the natural log of the upper limit minus the natural log of the lower limit.
  2. Divide by 2 times the standard error.
  3. For the 95% confidence interval this would be 2 x 1.96 = 3.92, for the 90% confidence interval this would thus be 2 x 1.645 = 3.29, and for 99% confidence intervals this would be 2 x 2.575 = 5.15.
  4. If the sample size in either group studied, say a treated group and a control group, is below 100, then I should assume that the authors reporting this hazard ratio calculated this confidence interval using a t distribution, and thus I should replace the numbers 3.92, 3.29 and 5.15 above with numbers specific to the t distribution and the sample size. I do this by going to t distribution tables with degrees of freedom equal to the sample size of both groups summed, minus 2.

This is how I would calculate a standard deviation in the R programming language for an example study reporting HR, 0.69; 95% CI, 0.54 to 0.89 in mCRC for cetuximab plus FOLFOX-4 vs FOLFOX-4 alone found here: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7044820/pdf/bmjopen-2019-030738.pdf:

(log(0.89) - log(0.54)) / 3.92 = 0.1274623

Is this the right way to calculate the standard deviation from the confidence intervals of a hazard ratio?

EDIT

To more clearly motivate this question, I am a health economist estimating transitions between health states. In my analysis, there is an initial, and well established, transition probability from the stable disease state to the progressive disease state under standard of care treatment.

The literature indicates that this transition probability is decreased by a new medical intervention. The literature describes the hazard ratio for progression with this new intervention vs standard of care based on a clinical trial of cancer patients. Thus, I would like to update the transition probabilities for transitioning from stable disease to progressive disease under standard of care using this hazard ratio, to create transition probabilities for this new intervention as part of a cost-effectiveness analysis of this new medical intervention.

Initially, this will be done just with the hazard ratio reported in the clinical trial. Following this, I would like to conduct a probabilistic sensitivity analysis which reflects the uncertainty in this hazard ratio when creating transition probabilities. To do this, I need to take random draws from the log-normal distribution for the hazard ratio, as hazard ratios are typically skewed unless put on the log scale to normalise.

The following code is used in the R programming language to make these draws:

hr_draws <- rlnorm(nsims, meanlog = log(mean), sdlog = SD). 

This is why I am trying to determine how to create the standard deviation for my hazard ratio as above, in order to create a probabilistic hazard ratio.

My sources are here:

https://handbook-5-1.cochrane.org/chapter_7/7_7_3_2_obtaining_standard_deviations_from_standard_errors_and.htm

https://handbook-5-1.cochrane.org/chapter_7/7_7_3_3_obtaining_standard_deviations_from_standard_errors.htm

https://cran.rstudio.com/web/packages/episensr/vignettes/b_probabilistic.html

$\endgroup$
11
  • 1
    $\begingroup$ Strictly speaking it is a standard error (not deviation) but the process looks fine to me. $\endgroup$
    – mdewey
    Sep 28, 2021 at 15:01
  • 1
    $\begingroup$ So, wait, am I not generating a standard deviation above? I ask because I need to use a standard deviation to generate random draws from a log-normal distribution for this hazard ratio, i.e. if I was to do this using R I need a standard deviation to include in my code. For the above example then I would do the following: draws <- rlnorm(1000, meanlog = log(0.69), sdlog = 0.1274623). But maybe what I'm including for the standard deviation part is wrong and I still need to calculate the standard deviation? $\endgroup$ Sep 28, 2021 at 15:38
  • 1
    $\begingroup$ The standard error is the standard deviation of the sampling distribution of a statistic. $\endgroup$
    – mdewey
    Sep 28, 2021 at 17:37
  • 2
    $\begingroup$ As I stated what you are calculating, and what I suspect you actually need, is the standard error of the log hazard ratio which is the standard deviation of the sampling distribution of the log hazard ratio. I cannot think of any other way to explain the situation. Your method is a calculation which flows by simple algebra from the formula for confidence intervals. $\endgroup$
    – mdewey
    Oct 2, 2021 at 15:08
  • 3
    $\begingroup$ What are you trying to accomplish by "taking random draws from the log-normal distribution for the hazard ratio" based on the "standard deviation of the sampling distribution "? Please edit your question to say why you wish to do that. The sampling distribution of a coefficient is to a great extent a function of sample size, not anything intrinsic to the underlying population. I fear that answering this question as posed will lead to a potentially misleading downstream application. $\endgroup$
    – EdM
    Oct 5, 2021 at 20:26

2 Answers 2

4
$\begingroup$

First, it's probably best to refrain from using the terminology "standard deviation" in the context of regression coefficients, as there's potential confusion in whether you mean the standard deviation of the sampling distribution of a statistic or the standard deviation of some value among members of the underlying population. The former depends on sample size, the second doesn't (although estimates of it do).

The term "standard error" is better here: it specifically has the former meaning, as both @mdewey and Wikipedia note. At least in R, the terminology "standard error" is used for reports of error estimates in regression coefficients.

Second, if you are evaluating hazard ratios from survival models, those are the exponentiations of coefficients determined by maximum (partial) likelihood methods with asymptotic normality assumed for the coefficient estimates in the original scale. t-statistics aren't involved in setting their confidence intervals (CI). That's also true for most risk ratios, rate ratios, and response ratios that you would see reported from logistic or Poisson regression models. It's wise to check the reported methods for statistical details; if the "significance" is based on a z-test or a Wald test then normality was assumed.

Third, in terms of your sensitivity analysis, it probably will be easiest and safest to sample from the assumed normal distributions of the regression coefficients and only move to the hazard-ratio scale at the last stage. If you are going to be doing simulations as part of your sensitivity analysis, the software will probably assume you are providing the regression coefficients that go into the linear-predictor values, not the hazard ratios.

Fourth, your desired formula for estimating the standard error of the coefficient estimate (and thus the standard deviation of the corresponding normal distribution you might use for sensitivity analysis) is essentially what you've written, except that your text in Step 2 doesn't agree with what you then do. For a normally distributed statistic, symmetric 95% CI (as usually assumed in the regression-coefficient scale) are at the 2.5th and 97.5th percentiles of the estimated distribution. Back calculating from the 95% upper and lower CI (UCI, LCI) of a hazard ratio thus provides a standard error estimate in the regression-coefficient scale: $$\text{SE}=\frac{\ln \text{UCI} - \ln \text{LCI}}{2 * 1.96}$$

with the $1.96$ value in the denominator changed as you note if the original CI were instead 90% CI or 99% CI.

$\endgroup$
6
  • $\begingroup$ I use the term SD because the code used in the R programming language to make draws from a HR's log normal distribution asks for a SD as below: hr_draws <- rlnorm(ndraws, meanlog= log(mean), sdlog = SD) And my purposes here are to make probabilistic draws from the log normal distribution for a HR as above. Can my code: (log(upper confidence interval) - log(lower confidence interval)) / 2*standard error create the SD of the sampling distribution of the log HR to include in the SD section for hr_draws above so that I can then include the HR value for mean and create these random draws? $\endgroup$ Oct 7, 2021 at 16:49
  • 1
    $\begingroup$ @JamesMoore the R rlnorm() function expects meanlog and sdlog argument values, which would be the mean log-hazard (not HR) and an SD in the log-hazard scale. The sdlog should be the SE of the log-hazard coefficient estimate, as in formulas of both answers. I'd do everything in the log-hazard scale and only exponentiate to HR at the end. Your "standard error" value in the denominator is wrong. As the other answer states, that should be the upper $\alpha/2$ quantile of a standard normal distribution, where$1-\alpha$ is the CI percentile. That value is 1.96 for 95% CI. $\endgroup$
    – EdM
    Oct 7, 2021 at 18:27
  • $\begingroup$ can you clarify Your "standard error" value in the denominator is wrong.? Do you mean because I used 3.92 rather than 1.96*2? When I apply (log(0.96) - log(0.86))/(2 * qnorm(1 - 0.05/2)) [1] 0.02806197 this provides the same results as (log(0.96) - log(0.86)) / (2*1.96) [1] 0.02806145, so am I OK to take the approach of (log(upper confidence interval) - log(lower confidence interval)) / 2*standard error, updating this for 90%/99% CI? Or what should be following the backslash instead of ` 2*standard error`? $\endgroup$ Oct 7, 2021 at 22:46
  • 1
    $\begingroup$ @JamesMoore the terminology is wrong. The value of 1.96 is not the “standard error” of anything. It’s the 97.5th percentile of a standard normal distribution. That’s the right value to plug into the denominator of your formula for 95% CI, but it’s not a “standard error.” It’s really important to use correct terminology to avoid ambiguity and confusion. $\endgroup$
    – EdM
    Oct 8, 2021 at 2:03
  • $\begingroup$ OK that makes sense! I said above that if the sample size in either group studied, say a treated group and a control group, is below 100 then I should assume that the authors reporting this HR calculated this CI using a t distribution and thus I should replace the numbers 3.29, 3.92 and 5.15 above with numbers specific to the t distribution and the sample size. It seems like your second point was not to do this, and to instead work off a 90% CI with a SE of 2*1.645, 95% CI with a SE of 2*1.96, and a 99% CI with a SE of 2*2.575. Would that be right, no t distributions for HR's in small samples? $\endgroup$ Oct 8, 2021 at 23:29
4
+50
$\begingroup$

The estimated log hazard ratio is assumed to follow a normal distribution. The estimated hazard ratio can't follow a normal distribution because it can't take values less than 0. Confidence intervals for the hazard ratio are calculated by constructing a confidence interval for the log hazard ratio then exponentiating. As you noted, you need to work on the log scale to get your standard errors and do your analysis, then exponentiate after you finish.

Confidence intervals for the log HR are constructed with a normal distribution, not a $t_{df}$ distribution. Further, the sample size in survival analysis refers to the number of events (deaths, progressive disease, etc.), not the total number of patients. Unless there is no censoring, these numbers are not the same.

The standard error of the log hazard ratio can be calculated from the confidence interval with:

$$ SE = \frac{log(Upper CI) - log(lower CI)}{2 * z_{\alpha/2}},$$

where $z_{\alpha/2}$ is the upper $\alpha/2$ quantile of a normal distribution. You can calculate the standard error in R with

(log(upper_ci) - log(lower_ci)) / (2 * qnorm(1 - alpha/2),

replacing alpha with the correct error rate (probably 0.05).

If you want to calculate the standard error of the hazard ratio (not log), you can use the Delta method. The standard error is $$SE(\text{log HR}) * exp(\text{log HR})$$

EDIT: It seems like OP is a bit confused about the difference between "standard error" and "standard deviation" and how that relates to their simulation. Standard deviation is the square root of the variance. Standard deviation is a measure of variability in an overarching (usually theoretical) population. "Standard error" refers to the standard deviation of a test statistic. These terms are sometimes used interchangeably, but they have different meanings. In OP's question, they are calculating the standard error of the (estimated) log hazard ratio. They are then correctly plugging that into rlnorm() to get random draws from the sampling distribution of the hazard ratio. In less precise terms, OP is using the reported log HR and the standard error to simulate a distribution of what the true hazard ratio could be.

$\endgroup$
9
  • 1
    $\begingroup$ Yes, that will correctly draw random samples from the sampling distribution of the log HR. $\endgroup$
    – Eli
    Oct 7, 2021 at 17:26
  • 2
    $\begingroup$ Yes, you can apply the same logic to those ratios. In R's rlnorm(), the meanlog parameter is the mean on the log scale. You would pass the log(HR) into that function. I think it's easier to work with rnorm(ndraws, mean = log(HR), sd = SD) then exponentiate, but the end result is the same. $\endgroup$
    – Eli
    Oct 7, 2021 at 20:42
  • 1
    $\begingroup$ It's the latter. "Standard error" is the name for the standard deviation ($\sqrt{\text{variance}}$) of the sampling distribution. Basically, if you estimate something you refer to the "standard deviation" as the "standard error". People often use the terms interchangeably, but they have different technical meanings if you want to be specific. Yes, the SD (SE) you created is on the log scale. $\endgroup$
    – Eli
    Oct 8, 2021 at 13:48
  • 1
    $\begingroup$ @JamesMoore, I added to my original answer to address your question. $\endgroup$
    – Eli
    Oct 8, 2021 at 14:01
  • 1
    $\begingroup$ I agree completely that it's easier and less error-prone to work in the log-hazard scale until the very end. The R rlnorm() might use log-mean and log-SD values as arguments, but I'd worry that other software might behave otherwise. Your addition about the confusion between "SD" and "SE" terminology is spot-on. +1 $\endgroup$
    – EdM
    Oct 8, 2021 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.