# Multiple one-sample t Test

I have a sample that can be divided into three groups. I now want to compare if any of the three groups differs from a given mean.

I have thought about conducting multiple one-sample t Tests but I do not know if I need to correct for alpha? I am really not sure. On the one hand, it is not a pairwise comparison, but on the other, it is still multiple testing.

What would you say? Is there maybe a more elegant way to it than to conduct multiple one-sample t Tests?

Kind regards, Helena

• You would probably correct for alpha. It's the number of hypothesis tests that triggers an alpha or p-value correction, as long as you consider them a family of tests. Dec 17, 2019 at 4:30
• It's an interesting question. I'm wondering if you could do something like represent the groups as dummy variables, subtract the given mean from all groups, and fit a general linear model where you force the intercept to be zero. I think then the tests for individual coefficients would indicate a group mean different from the given mean. The test from the anova may be the omnibus test. I'd have to play with it... But I'm not sure it's any more elegant than multiple t-tests. Dec 17, 2019 at 4:30

It may make sense to use an adjustment for alpha or for p values if multiple one-sample t tests are used. This adjustment is employed dependent on the number of hypotheses being tested that are considered in a family.

I think the following makes sense as way to combine several one-sample t tests into one model. In this scenario we have three groups, and want to compare them to a given mean of 3.

Essentially, the given mean is subtracted from the data for each group, and then a general linear model is fit, with no intercept, and the groups dummy coded as independent variables.

A = c(1,2,3,3,3,3,4,5)
B = c(3,4,4,4,5,5,5,5)
C = c(1,1,1,2,2,2,2,3)


One-sample t tests

t.test(A, mu=3)
### t = 0, df = 7, p-value = 1

t.test(B, mu=3)
### t = 5.2271, df = 7, p-value = 0.001216

t.test(C, mu=3)
### t = -5, df = 7, p-value = 0.001565


Combine the data into a single data set.

Y     = c(A, B, C)
Group = c(rep("A", length(A)), rep("B", length(B)), rep("C", length(C)))


Mean0 is the given mean. The syntax of the model is a little funky. Y - Mean0 could be done separately, but I'll do it within the model. 0 indicates that no intercept should be fit.

Mean0 = 3

model = lm(I(Y - Mean0) ~ 0 + Group)


I wonder if the anova results can be considered an omnibus test: testing if the mean of at least one group is different than the given mean.

anova(model)

###           Df Sum Sq Mean Sq F value    Pr(>F)
### Group      3 27.625  9.2083   11.13 0.0001393 ***
### Residuals 21 17.375  0.8274


summary gives tests for each group. Here, the results are somewhat different than conducting individual t tests. Also note that mean(B) = Estimate(GroupB) + Mean0.

summary(model)

### Coefficients:
###         Estimate Std. Error t value Pr(>|t|)
### GroupA  2.355e-16  3.216e-01   0.000 1.000000
### GroupB  1.375e+00  3.216e-01   4.276 0.000336 ***
### GroupC -1.250e+00  3.216e-01  -3.887 0.000851 ***

• You can also get the same result by using offset. This is a little more readable, I think: model2 = lm(Y ~ 0 + Group, offset = rep(3, length(Y))) Dec 17, 2019 at 14:52

The natural extension of the t-test to more than two groups is called ANOVA, and is well-studied with many off-the-shelf implementations.

Note that ANOVA is a fairly weak tool when used against the standard null of "all the groups are equal." Significance does not tell you very much.