Announcement

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

  • twoway lfit - model with covariates

    Hello everyone,
    I hope I could use your help with the command twoway lfit.
    I am estimating the following model:

    reg y m d d*m X

    where y and m are two continuous variables, d is a binary indicator =1 if m>0 (0 otherwise), d*m is an interaction term and X includes several covariates.
    I run the following command to get the graph of the regression line:

    two (scatter y m if !d) (scatter y m if d) (lfit y m if !d) (lfit y m if d)

    but I believe lfit is graphing the regression line from the model without controls. Is there a way to tell lfit to take into account the covariates? I tried the alternative command binscatter but it didn't really capture the exact relation between y and m I have estimated.

    Regards,

    Egidio

  • #2
    Your model doesn't define a line: it defines a set of hyperplanes (on the information you give).

    twoway lfit doesn't

    1. know anything except what you feed it or do more than show the line(s) you ask of it, one by one

    2. other way round, doesn't act as a post-modelling command or remember any previous results

    You need something more like marginsplot.

    Comment


    • #3
      Brilliant, thanks a lot!
      Apologies for the imprecise exposition of the problem above,

      Egidio

      Comment


      • #4
        Dear Egidio
        IThere is a way to achieve a dimension reduction which is explained in Hamilton, L. (2008) Statistics with Stata. This is called Conditional Effect Plots. Quoting the author (page 243): "CEP trace the predicted value of y as a function on one x variable, with the other x variables held constant at arbitrary values". Maybe it is worth to take a look if you are still interested in the graphic you were talking about.

        Juan Manuel

        Comment


        • #5
          Thanks Juan Manuel! I'll definitely take a look.


          Egidio

          Comment

          Working...
          X