female <- c(0.588, 0.546, 0.452, 0.646, 0.380, 0.434, 0.613,
0.652, 0.340, 0.491, 0.518, 0.403, 0.566, 0.516,
0.442, 0.636, 0.545, 0.377, 0.617, 0.481)
male <- c(0.375, 0.654, 0.374, 0.373, 0.224,
0.256, 0.563, 0.465, 0.488, 0.477,
0.427, 0.405, 0.402, 0.337, 0.655)
shapiro.test(female)
##
## Shapiro-Wilk normality test
##
## data: female
## W = 0.95448, p-value = 0.4401
Since the p-value is bigger than 0.05 we fail to reject
H0, so it is normally distributed.
shapiro.test(male)
##
## Shapiro-Wilk normality test
##
## data: male
## W = 0.95006, p-value = 0.5253
Since the p-value is bigger than 0.05 we fail to reject
H0, so it is normally distributed.
hist(female, main="Histogram for Female", xlab = "Values", ylab = "Frequency")
hist(male, main="Histogram for Male", xlab = "Values", ylab = "Frequency")
µf = Reaction time for females.
µm = Reaction time for males.
H0: µf = µm
H1: µf != µm
H0: σ2 f = σ2 m
H1: σ2 f != σ2 m
var.test(female, male, alternative = "two.sided", ratio=1)
##
## F test to compare two variances
##
## data: female and male
## F = 0.60404, num df = 19, denom df = 14, p-value = 0.3032
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.2111494 1.5988494
## sample estimates:
## ratio of variances
## 0.6040397
Since the alpha = 0.05 and p-value = 0.3032, we have
p-value > alpha , so fail to reject H0 . The
variances are not equal.
Population variances are unknown and sample size is small, use t-test.
ttest <- t.test(alternative = "two.sided", female, male, var.equal = FALSE)
ttest$conf.int
## [1] 0.0007052296 0.1602614371
## attr(,"conf.level")
## [1] 0.95
Since the confidence interval do not include zero, we reject H0 , so there is enough evidence to say that the mean values for female and male reaction times are differ from each other.