# How to find a confidence interval for a contrast?

I have a latin square with a particular treatment; I have done a contrast so I have a value for the mean of the contrast $$\hat \theta_1 = \mu_1-\frac{1} {3}(u_2+u_3+u_4) \>.$$

I also have a response error from the whole sample $\sigma^2$.

I have the variance of the contrast mean $$\mathrm{Var}(\hat \theta_1) \>,$$

the total N = 48, each treatment group size is 12, hence 4 groups.

to take a confidence interval I am trying things like

$$\bar x \pm t_{n-1}^{(1-\alpha/2)}\frac{s} {\sqrt{n} } \>,$$

but it's not giving me anything like I am expecting.

Is this the correct formula for a confidence interval of a contrast mean?

What is the sample variance $s^2$ in the context of the contrast?

-
This may be helpful: itl.nist.gov/div898/handbook/prc/section4/prc426.htm –  B_Miner Oct 9 '11 at 0:24

So basically, your model is given by:

$$\begin{array}{c c}Y_{ij}=\mu_{i}+\sigma\epsilon_{ij} & \epsilon_{ij}\sim N(0,1) & j=1,\dots,n_i & i=1,\dots,I\end{array}$$

Where $\epsilon_{ij}$ are pairwise independent. And you have $n_i=12,I=4$. Now, to create a confidence interval, we note that, because the $\epsilon_{ij}$ are independent, the within group means, $\overline{Y}_{i}=n_i^{-1}\sum_{j=1}^{n_i}Y_{ij}$ are independent, and also independent of the sum of squared errors. This also means that any linear combination can be dealt with easily. So we have:

$$\overline{Y}_{i}\sim N(\mu_i,n_i^{-1}\sigma^2)$$

Which means that, in your case, after a bit of calculation, we have

$$M=\overline{Y}_{1}-\frac{1}{3}(\overline{Y}_{2}+\overline{Y}_{3}+\overline{Y}_{4}) \sim N\left(\theta_1,\frac{1}{9}\sigma^2\right)$$

Where $\theta_1$ is as you have defined it in your question. This implies that $\frac{M-\theta_1}{\frac{1}{3}\sigma}\sim N(0,1)$. We also have:

$$\frac{(n-I)s^2}{\sigma^2}=\frac{\sum_{i=1}^{I}\sum_{j=1}^{n_i}(Y_{ij}-\overline{Y}_i)^2}{\sigma^2}\sim\chi^2_{n-I}$$

We also have the standard result that $Z\sqrt{\frac{v}{\chi^2_v}}\sim T_v$ (i.e. a T-distribution with v degrees of freedom), so we get:

$$\frac{M-\theta_1}{\frac{1}{3}\sigma}\sqrt{\frac{n-I}{\frac{(n-I)s^2}{\sigma^2}}}=\frac{M-\theta_1}{\frac{1}{3}s}\sim T_{n-I}$$

So a confidence interval would be (noting that you have $48-4=44$ degrees of freedom)

$$\overline{Y}_{1}-\frac{1}{3}(\overline{Y}_{2}+\overline{Y}_{3}+\overline{Y}_{4})\pm t_{1-\alpha/2}(44)\frac{s}{3}$$

-