I am running a logistic regression of marital status on education, age, income, religion, gender, race, MSA, hours worked. I have many categorical variables, such as religion importance or race that I group to a binary variable: Instead of having: Blacks, Hispanics and Others, I just have Blacks and Others. And for religion importance, that had initially a ranking of not important at all to very important (5 levels), I reduce the variable into religious or not religious. I have a fair amount of respondents (6k) that is why I think I shouldn't worry. Does anyone see any problem with this other than losing variation?
-
1$\begingroup$ What is your research question? What are you trying to estimate? Simply forecast marital status based on education? What is your motivation for choosing the courser classification? $\endgroup$– Matthew GunnCommented Apr 24, 2017 at 13:43
-
$\begingroup$ I have NLSY97 data and look at 2013 data, where respondents are between 28-32 and who got married and who didn't. I want to see which of the independent variables are significant in predicting marital status and which one predicts the highest log odds. The assignment is more about finding data and utilizing R than how relevant the research question is. I am just wondering whether I do a lot of harm, by regrouping the categorical variables and which problems it might bring having many categorical variables in a logistic regression. $\endgroup$– breeCommented Apr 24, 2017 at 14:11
1 Answer
The quick answer is, no what you are doing is already done in R if you are using the new_variable <- as.factor(yourdata$variable)
command.
The long answer is: what you are doing is just creating a dummy variable matrix. What is easy with creating your own dummy variable matrix is that you can adjust your baseline level easily (i.e. you want white to be your baseline ethnicity instead of black [which if they are listed as african american, they will be since R chooses the baseline of factors by alphabetical order). You can code your own baseline of course.
Now on the comment of religious Likert variable. There are two ways of doing this. The first is how you are doing it. The second is to treat each of the responses like a factor level. Personally, I would probably treat it as a 3x3 dummy matrix with the levels being Religious, non-religious, undecided (if that is what the 3 on the Likert scale corresponds to). That way, in your regression, you can use the undecided as your baseline. I feel it aggregates the scale a bit better than just doing religious/non-religious (though I cant say for certain since I am not familiar with the item in question).
-
$\begingroup$ The famous software is R not r. I have edited! $\endgroup$ Commented Nov 17, 2022 at 16:54