I have the df1:
Name Y_N FIPS score1 score2
1: Alabama 0 1 2633 8
2: Alaska 0 2 382 1
3: Arizona 1 4 2695 41
4: Arkansas 1 5 2039 10
5: California 1 6 27813 524
6: Colorado 0 8 8609 133
7: Connecticut 1 9 5390 111
8: Delaware 0 10 858 3
9: Florida 1 12 14172 215
10: Georgia 1 13 9847 308
11: Hawaii 0 15 720 0
12: Idaho 1 16 845 7
I would like to perform a T-test to see if score1
differs based on Y_N
. I would then like to plot these two against each other. I have made a boxplot that looks like:
Instead I want my graph to look like except with confidence bars: I want to now change from a boxplot to a plot that shows all of the individual points and then a mean horizontal line with 95% confidence intervals. How is this done? I would also like to add the text of the p-value in a corner of the graph.
I might try:
text(x = max(df1$Y_N)+1,
y = min(df1$score1)+20000,
labels = paste0(
"\np-value = ",
round(coef_lm[2,4],5),
pos = 4)
But I realize that coef_lm[2,4],5
are the test-statistics from a linear model. How do I access the outputs of a t-test?