# Testing and conidence interval in a clinical trial

In a clinical trial, let's say I want to test $$H_0: \mu_1 \leq \mu_2$$ $$H_1: \mu_1 > \mu_2$$

$$\mu_1$$ belongs to the placebo group and $$\mu_2$$ belongs to the trt group. I used an independent two-sample t-test to compare the two means. I wonder how to express the confidence interval here. And should the point estimate by $$\bar{X}_1-\bar{X}_2$$? I'm not familiar with statistics and clinical trials so I need some help.

• If you define $d=\mu_1-\mu_2$ then the null hypothesis becomes $d \le 0$ and the alternative $d>0$, with $\bar X_1-\bar X_2$ being the natural estimator of $d$. You are trying to find a confidence interval for $d$. May 14 at 11:21
• Notice that you ask about a one-sided 2-sample t test, but about a two_sided confidence interval. See my Answer. Also, you do not say whether you are suing the pooled 2-sample t test or the Welch 2-sample t test. Unless you have solid advance evidence that the two populations have the same variance, you should use the Welch test. May 14 at 14:56

If you use statistical software to test the hypothesis $$H_0: \mu_1 \le \mu_2$$ against $$H_a: \mu_1 > m_2$$ you will typically get a 95% confidence interval for $$\mu_1 - \mu_2$$ as part of the output.

Suppose you have data similar to the fictitious data, simulated using R statistical software below:

set.seed(2022)
x1 = rnorm(1000, 50, 7)
x2 = rnorm(1000, 55, 8)

summary(x1)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
25.67   45.28   49.65   50.01   54.79   76.36
length(x1);  sd(x1)
[1] 1000              # sample size
[1] 6.987677          # sample standard deviation

summary(x2)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
25.86   49.61   54.99   54.97   60.66   79.58
length(x2);  sd(x2)
[1] 1000
[1] 8.190649

boxplot(x1, x2, horizontal=T, col="skyblue2")


Then a Welch two-sample t test, which does not assume that treatment and control populations have the same variance, goes as shown below. Because the P-value is near $$0,$$ we reject $$H_0$$ in favor of the one-sided alternative $$H_0.$$ The 95% one-sided 95% confidence interval is $$(-\infty, -4.40)$$ so that $$\mu_1 - \mu_2,$$ estimated by $$\bar X_1 - \bar X_2 = 50.00961 - 54.97116 = -4.96155$$ is likely less than the upper bound $$-4.40128 \approx -4.40.$$

        Welch Two Sample t-test

data:  x1 and x2
t = -14.573, df = 1949.6, p-value < 2.2e-16
alternative hypothesis: true difference in means is less than 0
95 percent confidence interval:
-Inf -4.40128
sample estimates:
mean of x mean of y
50.00961  54.97116


If you want a 2-sided 95% CI, then you can get it as part of the output for a 2-tailed (or 2-sided) test, specifically $$(-5.63, -4.29),$$ which is centered at $$\bar X_1 - \bar X_2 = 50.00961 - 54.97116 = -4.96155 \approx -4.96.$$

t.test(x1,x2)$conf.int [1] -5.629265 -4.293849 attr(,"conf.level") [1] 0.95  Output from Minitab statistical software for summarized data above, is shown below, where 0.000 means $$< 0.0005:$$ Two-Sample T-Test and CI Sample N Mean StDev SE Mean 1 1000 50.01 6.99 0.22 2 1000 54.97 8.19 0.26 Difference = μ (1) - μ (2) Estimate for difference: -4.960 95% upper bound for difference: -4.400 T-Test of difference = 0 (vs <): T-Value = -14.57 P-Value = 0.000 DF = 1949  Again here, the two-sided 95% CI $$(-5.628, -4.292)$$ accompanies the two-sided test. Two-Sample T-Test and CI Sample N Mean StDev SE Mean 1 1000 50.01 6.99 0.22 2 1000 54.97 8.19 0.26 Difference = μ (1) - μ (2) Estimate for difference: -4.960 95% CI for difference: (-5.628, -4.292) T-Test of difference = 0 (vs ≠): T-Value = -14.57 P-Value = 0.000 DF = 1949  Both programs use the following formula for the 2-sided 95% confidence interval of $$\mu_1-\mu_2:$$ $$\bar X_1 - \bar X_2 \pm t^*\sqrt{\frac{S_1^2}{n_1}+\frac{S_2^2}{n_2}},$$ where $$n_i, \bar X_i, S^2_i$$ are the sample size, mean, and variance, respectively, of the $$i$$th sample, and $$t^*$$ cuts probability $$0.025$$ from the upper tail of Student's t distribution with the appropriate degrees of freedom. In my example $$t^*=1.96.$$ • Thank you for your detailed answer! It is a one-sided test so I was pretty confused. May 15 at 2:34 • Is one-sided test CI is different from the formula you provided? May 15 at 2:46 • Yes, a one-sided CI is usually used along with a one-sided test. The formula for the one-sided interval is different: No$\pm,$just$+$to get an upper bound, in this problem (and$t^*\$ cuts 5% of the area from the upper tail of the standard normal density curve. May 15 at 3:58
• I guess my case is a one-sided test then. There is not much information about a one-sided CI in a clinical trial so I was very confused. Thank you. May 15 at 4:19