Hello!
I would like to create a loop that allows me to select all the possible combinations of 2 variables from a list of n variables and fit a logistic regression model for each combination.
For example, let's suppose that there are 8 variables x1 - x8.
I want to fit 36 logistic models:
logit y xk xl w z
where y is the dependent variable, w and z are covariates, and xk and xl are 2 independent variables from the group above.
Is it possible to do this with a loop instead of writing 36 lines of code?
Thank you in advance for your help!
Related Posts with How to create a loop to select 2 variables from a list?
egen rowtotal with missing valuesHello, My code is this: Code: egen rm=rowmiss( var1- var10) . . egen Audit=rowtotal( var1- var…
How to add zero before the observation in a variable?Dear Stata user, Suppose, I have a varibale named "price", which ranges from the 3291 (4 digits) to …
grqreg graph optionshi I am running multiple quantile regressions on different samples and use grqreg to show it graphi…
Declaring data to be survival dataA beautiful morning to you all. I am new in this forum. I am running survival analysis to establish …
Cox model refuses to calculate SEs for year dummies!Dear Statalist, I am looking for help with my Cox regression (a survival analysis). My unit of ana…
Subscribe to:
Post Comments (Atom)
0 Response to How to create a loop to select 2 variables from a list?
Post a Comment