I have a biological problem which involves using a 1-sided two-sample t-test. To simplify the problem, let’s assume an experiment comparing quantities in a control (C) and a treatment (T) group, each having 3 replicates, called C1, C2, C3, T1, T2, T3. Here, C1 and T1 are samples from the same subject, C2 and T2 are samples from the same subject, and so on.

Now I obtain a number for each of the following combinations. "within" = within group (i.e. both are C or both are T). Also, the number after C or T indicate whether they're from the same subject (sub) or not.

C1_C2 (within: different sub)
C1_C3 (within: different sub)
C1_T1 (between: same sub)
C1_T2 (between: different sub)
C1_T3 (between: different sub)
C2_C3 (within: different sub)
C2_T1 (between: different sub)
C2_T2 (between: same sub)
C2_T3 (between: different sub)
… (a total of 15 pairwise quantities)

We are essentially interested in comparing the quantities "within" group and the quantities "between" group, but hoping to incorporating the "subject" effect somehow in the t-test. Is there a way to distinguish “different sub” and “same sub” in the test?

Thank you so much for your suggestions!!


You can try and use linear regression using dummy variables. Try to regress the difference of each pair (let's call it $Y_i$) with a dummy variable marking if it's a "between" group ($D_1$ which can get 1 if it's "between" or 0 if it's "within") and an interaction dummy variable $D_1\cdot D_2$ ($D_2$ gets 1 if it's "same sub" of 0 otherwise).

So the regression equation will be:
$Y_i=\beta_0+\beta_1\cdot D_{1,i} + \beta_2\cdot D_{1,i}\cdot D_{2,i} + \epsilon_i$
$Y_i$ - each pairwise difference
$D_{1,i}$ - 1 if it's "between", 0 otherwise
$D_{2,i}$ - 1 if it's "same sub", 0 otherwise

The results can be interpreted:
$\beta_0$ - the mean difference in the "within" group
$\beta_0 + \beta_1$ - the mean difference in the "between" group, without "same sub"
$\beta_0 + \beta_1+ \beta_2$ - the mean difference in the "between" group, with "same sub"

If you run this regression in stata, for example, you will get the t-test result for each $\beta$, so you could know if it's statistically significant. If $\beta_1$ is significant, it means that the change between the groups is significant. If $\beta_2$ is significant, it means that the "same sub"/"different sub" distinction is significant.

Dummy variables - additional explanation


Since the "same sub" samples are only in the "between" group, we need to know if they affect its mean. I would suggest running another test to compare the mean difference in the "between" group with the "same sub" samples and the mean difference in this group without the "same sub" samples (without C1_T1, C2_T2, C3_T3).
If this test will show no significant difference, then those samples do not affect the mean of the group, and you can run the test between the 2 groups.
If the test will show a significant difference, then you practically have 3 groups (within, between different subs, between same sub), and you can continue and assign a biological meaning to it.

  • $\begingroup$ Thanks for the suggestion! Yes, I can make such comparisons to see if the "same sub" will affects the mean of the "between" group. However, I am just curious if there is a way to automatically account for such "extra" grouping, i.e. assuming there is an underlying significant difference present... Thanks ;-) $\endgroup$ – alittleboy Jul 13 '13 at 18:20
  • $\begingroup$ @Iyosef769: thank you so much! Sorry I mean to award the bounty for your answer above ;-) $\endgroup$ – alittleboy Jul 17 '13 at 19:28

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.