Announcement

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

  • How to use iv*iv in regression

    Hello everyone:

    Is there anyway that i can run a reg like: reg dv iv1 iv2 iv3*iv4
    By which mean iv3*iv4, I already have iv3 and iv4 available, is there any easyway other than generate a new variable: iv5=iv3*iv4?

    Thanks,

  • #2
    Lucas:
    as per -fvvarlist- notation (that I strongly recommend you to read; see -help fvvarlist- and related entry in Stata .pdf manual), you may want to consider something along the following lines:
    Code:
    *Interaction between continuous predictors*
    reg dv iv1 iv2 c.iv3##c.iv4
    *Interaction between categorical predictors*
    reg dv iv1 iv2 i.iv3##i.iv4
    You can easily tweak the code yourself if the interaction is composed of a continuous and a categorical predictor.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment

    Working...
    X