In: Statistics and Probability
In r studio, how do you find significant variables that differ between two datasets of the same variables?
Suppose we have a data set of 10 male student score and
10 female student sore out of 100 in mathematics final exam and we
have to check is there significant difference between their average
scores.
To check this we use two sample t test assuming equal
variance.
Male_Student = c(60,65,64,75,84,81,72,76,70,55)
Female_Student = c(72,76,67,89,81,73,78,60,64,63)
length(Male_Student)
length(Female_Student)
t.test(Male_Student,Female_Student,var.equal=TRUE)
_________________________________________________________________
R - code with output
> Male_Student = c(60,65,64,75,84,81,72,76,70,55)
> Female_Student = c(72,76,67,89,81,73,78,60,64,63)
> length(Male_Student)
[1] 10
> length(Female_Student)
[1] 10
> t.test(Male_Student,Female_Student,var.equal=TRUE)
Two Sample t-test
data: Male_Student and Female_Student
t = -0.51376, df = 18, p-value = 0.6137
alternative hypothesis: true difference in means is not equal to
0
95 percent confidence interval:
-10.68755 6.48755
sample estimates:
mean of x mean of y
70.2
72.3
_____________________________________________________________________
Decision -
Observe that P-value = 0.6137 > alpha = 0.05, Do Not Reject null hypothesis of their is no significant difference between male and female student averages in mathematics subject.
Conclusion - From sample data, there is insufficient evidence to say that there significant difference between male and female average scores in Mathematics.