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 ***