Hello everyone,
Thank you so much in advance for your time and support.
I am conducting a path analysis using the sem command in Stata. All of my mediators and outcome variables are continuous. The independent variables include continuous, dichotomous, and categorical variables.
As I understand it, the sem command does not support factor variable notation (e.g., i.varname), so I created dummy variables manually for the categorical variables with three or more categories. I would appreciate it if you could review my approach and let me know if it is correct.
Example: Race/Ethnicity Variable
To set Non-Hispanic White (0) as the reference group, I created the following dummy variables:
These dummy variables are coded as 1 if the participant belongs to the specified group, and 0 otherwise.
Questions:
Thank you so much in advance for your time and support.
I am conducting a path analysis using the sem command in Stata. All of my mediators and outcome variables are continuous. The independent variables include continuous, dichotomous, and categorical variables.
As I understand it, the sem command does not support factor variable notation (e.g., i.varname), so I created dummy variables manually for the categorical variables with three or more categories. I would appreciate it if you could review my approach and let me know if it is correct.
Example: Race/Ethnicity Variable
Code:
tab racehisp_2015 racehisp_2015 | Freq. Percent Cum. ----------------------------------------+----------------------------------- 0 Non-Hispanic White | 894 61.53 61.53 1 Non-Hispanic Black | 405 27.87 89.40 2 Others (AI/AN/Asian/NHPI/Other/Hispan | 154 10.60 100.00 ----------------------------------------+----------------------------------- Total | 1,453 100.00
Code:
gen black_dummy_2015 = (racehisp_2015 == 1) gen others_dummy_2015 = (racehisp_2015 == 2)
Code:
tab black_dummy_2015 black_dummy | _2015 | Freq. Percent Cum. ------------+----------------------------------- 0 | 1,048 72.13 72.13 1 | 405 27.87 100.00 ------------+----------------------------------- Total | 1,453 100.00
Code:
tab others_dummy_2015 others_dumm | y_2015 | Freq. Percent Cum. ------------+----------------------------------- 0 | 1,299 89.40 89.40 1 | 154 10.60 100.00 ------------+----------------------------------- Total | 1,453 100.00
- Does this approach correctly treat Non-Hispanic White as the reference group?
I understand that each dummy variable includes Non-Hispanic White and the remaining group(s) in the 0 category. Is this appropriate for creating dummy variables? - Should all dichotomous variables in the model be coded as 0 and 1?
For example, should “1” consistently indicate the presence of a characteristic or condition, and “0” indicate absence?
Comment