Control variable in multiple regression in R-Studio?
Hello,
Before I ask my question, I need to explain briefly.
I want to use the Allbus2021 data to clarify my hypothesis about whether the approval/opposition of abortion changes depending on the social class of the respondent. My dependent variable is the opinion on abortion, and my independent variable is social class. I've already run a multiple regression in R Studio, and it was (somewhat) successful. However, to determine whether the effect is significant, the instructor suggested I include age as a control variable. But now I'm pretty clueless about how to go about it.
Does anyone here have a tip on how I can add age as a control variable as easily as possible? Perhaps using R commands, that would really help me immensely! <3
This is then simply an additional predictor. Social layer(s) you certainly have silly-coded, so several predictors are already in the model. Age is just another.
Hello first,
thank you for your help!
So I don’t know exactly if this is meant by stupidy-encoded, but I relabeled the social layer (under,workers, middle, top, middle, top, top) and used as a factor variable.
Do I have to do that with age or do I code it differently?
You used this as a categorial factor, is that meant? If R can handle this, it’s good. However, I am not aware that R then calculates a variance analysis or actually a regression (so that each stage should be coded with 0=not applicable 1=corresponding stupidy; one step stays completely out, this is the “reference stage”).