Description. Show ALL syntax and outputs. Attached is also the assignment. This cannot be late as its due 12pm.
SOCI 315
Lab Demo 3
Dummy variables and a mixed model
Let’s consider the example predicting the level of Family Support by Gender
- Family support – dependent variable
tab RA1SKINPO
tab RA1SKINPO, nol
gen familysupport=RA1SKINPO
recode familysupport (-1=.) (8=.)
tab familysupport
- Gender – independent variable
tab RA1PRSEX
tab RA1PRSEX, nol
Now, we need to create a dummy variable of women=1 and men=0, the category of reference
gen women = RA1PRSEX
recode women (2=1) (1=0)
tab women
- Regression model with the dummy variable
regress familysupport women
Let’s add another predictor into the model – the sense of belonging
- Sense of belonging – independent variable
tab RA1SA22H
tab RA1SA22H, nol
we will need to reverse code this variable so lowest number indicates the lowest level of belonging and highest number indicates the highest level of belonging
and we also need to remove missing values
gen belong = RA1SA22H
recode RA1SA22H (-1=.) (1=5) (2=4) (3=3) (4=2) (5=1) (8=.)
check whether the recoding is correct
tab1 belong RA1SA22H
- Regression mixed model with the dummy variable and a continuous predictor
regress familysupport women belong