Announcement

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

  • Appending models using coefplot

    I would like to merge multiple models into the same series (crude/adjusted/further adjusted models) from regression results stored from a loop.I would appreciate if someone can help with syntax below.

    sysuse auto, clear


    ** Unadjusted model ***
    foreach var in mpg trunk length {
    quietly regress price `var'
    estimates store `var'_unadusted
    }


    ** Adjusted model with "turn" as a confounder ***
    foreach var in mpg trunk length {
    quietly regress price `var' turn
    estimates store `var'_adjusted
    }


    ** Further Adjusted model with "turn" as a confounder ***
    foreach var in mpg trunk length {
    quietly regress price `var' turn weight length foreign
    estimates store `var'_adjustedfurther
    }




    coefplot (mpg trunk length , label(unadjusted)) ///
    (mpg trunk length , label(adjusted)) ///
    (mpg trunk length , label(further adjusted)) ///
    , drop(_cons) xline(0)
    Last edited by Anteneh Assefa; 14 May 2019, 09:19.
Working...
X