Reputation: 1
I have a final lab and am trying to run a T-test to see if there is a significant difference between salary if you major in a STEM major vs a Humanity major vs a Social Science major. I have each major labeled as either SS, S, or H in one column. Is there a way I could compare each group easily? Thanks
Upvotes: 0
Views: 37
Reputation: 78
You probably want to use the pairwise t-test functionality from here Pairwise T Test. I personally like to use the Bonferroni correction since it is conservative (it simply divides the p-thresholds by number of comparisons).
You also probably want to graph your output by using something like
dat_grouped <- dat %>% group_by(Major) %>% summarise(Mean_Salary = mean(Salary), SD_Salary = sd(Salary), N= n())
ggplot(data = dat_grouped, aes(x=Major, y = Mean_Salary )) +
geom_col() + geom_errorbar(aes(ymin =Mean_Salary -1.96*SD_Salary , ymax = Mean_Salary +1.96*SD_Salary), width = 0.25)
Upvotes: 1