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?
HH to individual levelHello, In the survey I'm using, I have information on time taken to collect water by women in a HH a…
How to create a child number indicator?Hi all, Everyone was really helpful on my last post. Currently, I have a dataset that has parents (…
New package: rowsumHi Everyone, I write a new package called "rowsum" (my first package : ). It sums the values of mul…
How to add average treatment effect line in event study plotDear community, I want to add the average treatment effect (and confidence interval) when plotting …
Where to find globdist.adoI am reading a Stata do file which was probably authored before 2015. It uses globdist. I tried "fi…
Subscribe to:
Post Comments (Atom)
0 Response to How to create a loop to select 2 variables from a list?
Post a Comment