I've built a logistic regression, but I am having difficulty interpreting/rationalising the main components in my head. I'm using Stata v 16.1 on a Mac (V 12.0.1 monterey)
The brief background prior to questions:
The outcome variable is a binary outcome (Yes/No to consent for data extraction)=ConG
ARIAL is an independent variable evaluating remoteness (0 1 2 3) 0=least remote
SEIFAl is a socioeconomic index (I've divided it into quartiles, 0= most disadvantaged, 3=least disadvantaged)
Sexl independent variable representing male=0, femal=1
Agel independent variable categorised into 0=<30 years old 1=30-50 2=50-70 3>70
I've attached a very subtracted copy of the dataset and code for the regression at the bottom.
Specific questions,
1. I know marginal effects (MEs) can't be used for the interaction term as it can't change independently of the effects of the main components, but is the converse true i.e can MEs still be interpreted for the main components?
2. My original model didn't have an interaction term, but the model with the interaction term looks to be a better fit for the data based on residual diagnostics, AIC and nested LR tests. From my original model I was able to calculate predicted probabilities based on marginal effects for categories such as 30-50 year old male with low socioeconmic index, but in the new model I can't figure out the code
Example
Code:
*Original model logistic ConG i.Agel i.Sexl i.ARIAL i.SEIFAl margins Agel#SEIFAl marginsplot , noci xtitle("Age (years)") ytitle("Percentage (%)") title("Probability of Consenting to Data Extraction based on Age and SEIFA") xlabel(0 "<30" 1 "30-50" 2 "50-70" 3 ">70") ylabel(.5 "50" .6 "60" .7 "70" .8 "80" .9 "90")
So the main issue I have is (even though this model has a better fit for the data) how to use it to obtain predictions from the regression equation using Stata (I guess I could add up the individual coefficients and exponentiate them, but I would like something more efficient).
Code:
ConG ARIAL SEIFAl Sexl Agel 0 0 2 0 0 1 0 2 1 0 1 0 3 1 0 1 0 2 1 0 1 0 3 1 0 1 0 3 1 0 1 2 1 0 0 1 2 1 0 0 1 0 3 1 0 1 0 2 0 0 1 0 2 1 0 1 2 1 0 0 1 0 0 1 0 1 2 1 0 0 1 0 2 0 0 1 0 2 0 0 1 0 2 0 0 1 0 1 0 0 0 1 0 1 0 1 0 3 1 0 0 0 3 1 0 1 0 2 0 0 1 0 1 0 0 0 0 2 0 0 1 0 1 1 0 1 0 1 0 0 1 0 3 1 0 1 0 2 1 0 1 0 2 0 0 1 0 3 1 0 1 0 3 0 0 1 0 1 0 0 1 0 1 1 0 1 0 1 1 0 1 0 1 0 0 1 0 3 1 0 1 0 2 1 0 1 0 2 1 0 1 0 1 1 0 1 0 1 1 0 1 0 3 1 0 1 0 2 0 0 1 0 1 1 0 1 0 1 1 0 1 0 1 1 0 1 0 3 1 0 1 0 3 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 1 0
Code:
*Model with interaction term logistic ConG i.Agel i.Sexl i.ARIAL i.SEIFAl Agel#SEIFAl
Don
0 Response to Model prediction for logistic regression with an interaction term
Post a Comment