I tried implementing an independent t-test (alpha = 0.05) using excel for male(n=20) and female(n=25) scores. However, excel doesn't allow it. Are there alternative tests for comparing the two samples??
-
5$\begingroup$ I hope I will not sound arrogant, but don't use excel for data analysis. In the windows on the bottom of the page you may code your t-test and execute it, and it does allow different sample sizes. rdocumentation.org/packages/stats/versions/3.6.1/topics/t.test $\endgroup$– German DemidovCommented Nov 10, 2019 at 15:14
-
1$\begingroup$ The alternatives are 1) use other statistical package you are familiar with (again, t-test will work for unequal sample sizes in most of them), 2) write to Microsoft a report that they should fix excel, 3) learn basic R syntax (it will take around 5 minutes to code your vectors and perform a test) $\endgroup$– German DemidovCommented Nov 10, 2019 at 15:20
-
3$\begingroup$ I was going to respond "You don't need a different test, you need different software." There are many threads on this site about free statistical software. Just this week, I was working with a colleague who was using Excel for statistical analysis. I got her to try Jamovi. Result: an email that said only, "I love Jamovi. Thank you." $\endgroup$– Sal MangiaficoCommented Nov 10, 2019 at 15:26
-
1$\begingroup$ I think there is a possibility that you are trying to do a paired t test, which does require equal numbers of observations for the two groups. Whatever software you use, you need to be sure you know the difference between a paired t test and a t test for independent samples. $\endgroup$– BruceETCommented Nov 10, 2019 at 15:36
-
2$\begingroup$ Unequal sample-size two sample t-test works in Excel. $\endgroup$– Glen_bCommented Nov 10, 2019 at 15:48
1 Answer
I will show you how to do a two-sample t test using R. In my illustration,
there are 10 males and 15 females. Notice that the syntax for entering
data requires a c
at the beginning of a list.
male = c(55, 57, 53, 52, 53, 54, 55, 52, 54, 56)
female = c(54, 52, 51, 55, 53, 53, 52, 51, 54, 52, 50, 53, 52, 54, 53)
summary(male); length(male); sd(male)
summary(female); length(female); sd(female)
Now some summary statistics. Notice that the sample mean for males is slightly larger than the sample mean for females. A t test will determine whether this small difference is statistically significant.
summary(male); length(male); sd(male)
Min. 1st Qu. Median Mean 3rd Qu. Max.
52.0 53.0 54.0 54.1 55.0 57.0
[1] 10 # sample size
[1] 1.66333 # sample SD
summary(female); length(female); sd(female)
Min. 1st Qu. Median Mean 3rd Qu. Max.
50.0 52.0 53.0 52.6 53.5 55.0
[1] 15
[1] 1.352247
Here is a pooled 2-sample t test. The formula can be found in
almost any elementary statistics text. You can verify results using
a calculator. Notice the use of the 'parameter' var.eq=T
in the
statement that performs the test. Notice that the number of degrees of freedom df
is 10 + 15 - 2 = 23.
t.test(male, female, var.eq = T)
Two Sample t-test
data: male and female
t = 2.4796, df = 23, p-value = 0.02091
alternative hypothesis:
true difference in means is not equal to 0
95 percent confidence interval:
0.248604 2.751396
sample estimates:
mean of x mean of y
54.1 52.6
Unless you have prior knowledge that the two populations have the same variance, it is best to do a Welch two-sample t test. You may be able to find the formula for this test in an elementary statistics text or by searching the Internet. This tests uses a more complicated formula for the degrees of freedom (in order to adjust for the possibility the population variances may not be equal). That formula is a little messy (but not impossible) to compute on a calculator.
Following good statistical practice, R uses the Welch version of the two-sample t test unless instructed to do otherwise. When sample sizes are unequal the pooled T statistic and the Welch T statistic are a little different.
t.test(male, female)
Welch Two Sample t-test
data: male and female
t = 2.376, df = 16.606, p-value = 0.02983
alternative hypothesis:
true difference in means is not equal to 0
95 percent confidence interval:
0.1656084 2.8343916
sample estimates:
mean of x mean of y
54.1 52.6
For my fake data, both versions of the two-sample t test reject (5% level) the null hypothesis that population means are equal. Notice that the P-value is smaller than 0.05 in the output for each test.
So the difference 54.1 - 52.6 = 1.5 between the two sample means is statistically significant. Whether such a difference is of practical importance is another matter.
Note: When Excel was first released years ago, there were some serious difficulties with its implementation of many statistical procedures. Reports in statistical journals have indicated that the most serious difficulties have been fixed. My guess is you can get nearly the same results shown in R above if you use Excel correctly with the same data. However, I agree with the Comments that you may benefit in the long run if you learn to use R instead of Excel. There are many alternative statistical software packages, but R is excellent software, available free of charge, and easy to install. There are many help pages for using R on the Internet.