The two-sample T-test in R

We can run a T-test in R, using the package BSDA, and its function tsum.test. Lets try it.

library ("BSDA")           #load the library
Males_Mean=630.1  
Males_SDSD=13.42

Females_Mean=606.8
Females_SD=13.14

SampleSize= 10

tsum.test(mean.x=Males_Mean, s.x = Males_SDSD, n.x = SampleSize,
          mean.y=Females_Mean, s.y = Females_SD, n.y = SampleSize,
          alternative = "greater", mu = 15, conf.level = 0.95)


#the parameters needed to run a T-test are self-explanatory. x parameters would be for males and y parameters for females, mu is the expected difference between the population means, which we know from the example is 15 score points
R-results for a two-sample T-test

Figure 11.7: R-results for a two-sample T-test