Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • For loop for running multiple regressions in Stata

    I am new to STATA.

    I know how to run logistic regressions individually and to predict values and residuals. I want to know how I can do this in a for loop.

    If I have a y-variable and multiple x-variables, how can I run multiple Logistic regressions and predict the values and residuals. Specifically, how can I do the following in a loop:

    logit y-variable x-variable1
    predict values1
    predict residuals1, res

    logit y-variable x-variable1 x-variable2
    predict values2
    predict residuals2, res

    logit y-variable x-variable1 x-variable2 x-variable3
    predict values3
    predict residuals3, res

    logit y-variable x-variable1 x-variable2 x-variable3 x-variable4
    predict values4
    predict residuals4, res
    Last edited by Tinotenda Mhlanga; 14 Nov 2022, 23:43.

  • #2
    Tinotenda:
    welcome to this forum.
    See https://www.statalist.org/forums/for...-in-regression
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Cross-posted and answered at https://stackoverflow.com/questions/...le-regressions

      Please note our explicit policy on cross-posting, which is that you are asked to tell us about it. https://www.statalist.org/forums/help#crossposting

      Comment

      Working...
      X