Here, we’ll test whether there’s a statistically significant differenct between men and women in social dominance orientation: First, specify the categorical predictor as a factor:
analysis_data$Gender <- factor(analysis_data$Gender)
We do this so R is sure to analyze this data as categorical. Now we can run our test. Note: the dependent variable comes before the tilda.
Gender_x_SocDom <- t.test(analysis_data$SocialDominance ~ analysis_data$Gender, na.action=na.exclude, var.equal = TRUE)
Gender_x_SocDom
##
## Two Sample t-test
##
## data: analysis_data$SocialDominance by analysis_data$Gender
## t = -0.65955, df = 87, p-value = 0.5113
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.8328525 0.4178372
## sample estimates:
## mean in group Female mean in group Male
## 2.237805 2.445312
To report a t-test properly, you’ll need the p-value and the t-value. You’ll also need the grouped means (which are available at the bottom) and the grouped standard deviations (which you’ll need to calculate yourself; see descriptive statistics page).