Gender-based Self-reported Happiness
Learn how to analyze if gender affects self-reported happiness.
The first question we address using the
- Null hypothesis: Gender and happiness are statistically independent of each other.
- Alternative hypothesis: Gender and happiness aren’t statistically independent of each other.
Create and describe discrete variables
Before we test the hypotheses, we must first prepare data for the two variables and describe their individual and joint distributions.
Create and describe dichotomous happiness variable
We begin by tabulating the self-reported happiness variable V10
, and then create a dummy variable based on V10
. The table()
function tabulates the number of observations under each value of the variable V10
. As shown, the variable contains values listed in the
Get hands-on with 1400+ tech skills courses.