I am working on a large dataset (2000 patients, 100 variable) My purpose is to identify the influence of the variable (VarX1, VarX2, VarX3,…..) on a dichotomial outcome (VarY).
My purpose is to perform a manual Stepwise regression analysis on a logistic regression in order to select the best variable to explain the outcome (VarY). I have several problems understanding the stepwise regression analysis; here is what I understand so far:
I am starting with the null model. : VarY~1
I add all variables consecutively into the model (VarY~VarX1, VarY~VarX2, VarY~VarX3….) and select the Var with the minimum p value and a p value above 0.05 Here is my first question: For a quantitative variable with 3 parameters (example: color: blue/yellow/green), there will be two beta, and two p value estimated. How can I deal with that, especially if there is one pvalue >0.05 and another one <0.05 ?
- I add the variable with the least p value into my model. Let’s say that VarX5 is added into the model
- I repeat number 2 in order to add one variable. Let’s say I add VarX8 into the model : VarY~VarX5+VarX8
- I am supposed to make a backward selection, and this is beginning to be “fuzzy” : I should retrieve only the higher p value? When I have more variables, and at one point, two or three variable have a p value over 0.05, how should I manage that? Or I should retrieve only the last variable added into the model (for example, for the model into step 4, I retrieve only VarX5?
Thank you for your help, or for any of the article/tutorial/link you can give me.
EDIT : Thanks to those who gave me some answers. In order to clarify, I am aware of the limitation of the stepwise analysis. My purpose is to understand how it works. And if several publication point out the failure of this analysis, I could not find a clear one that explain all the processes.
EDIT 2 : I have seen the method with the AIC and the BIC, which are simpler and answers both questions. ;) This is the method with the p value that I am concerned about.