Announcement

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

  • Full interaction model

    Dear Statalisters,
    I am running a full interaction model where all my variables are multiplied by year and gender as below:

    Code:
    global indep12 "i.agegrp5##female##year2012 i.educ4##female##year2012 i.urban##female##year2012 i.public##female##year2012"
    Code:
    xttobit $dep $indep1 [iw=panel_wt_06_12], ll(0)
    I have two questions:
    1) Is there a better/more efficient way of writing interaction terms rather than the way I did it?

    2) Is there a command for calculating the coefficients by gender and year and automatically calculates the p-values?
    I mean like calculating the coefficients for females in 2012 and in 2006 and the coefficients for males in 2012 and 2006 from the Tobit model results rather than aggregating them manually.

    Thanks in advance.
    Maye

  • #2
    (1) See help for factor variables, and note examples.
    (2) You may find the answer in margins, contrast.

    Comment


    • #3
      Thank you for your reply.
      1) The help file only provides a reference for two variables interaction model, like the example below.
      Code:
      regress y sex##(group c.age c.age#c.age)
      However, I am looking for a shorthand for a three variables interaction term, i.e. the effect of education by gender and year.

      2) IF I understand correctly, the margins provide the mean of the outcome variable while other variables are held constant. and it comes as a second step after presenting the coefficient estimates. I am trying to calculate the coefficient estimates of my full interaction terms to present them first, then these will be followed by the predicted effects.

      Comment


      • #4
        Hi Maye,
        Im not sure about the marginal effects question, but regarding your interactions you can always write it this way:
        Code:
        global indep12 "(i.agegrp5  i.educ4  i.urban  i.public)##(female##year2012)"
        Just because the last two terms repeat for all the interactions.
        HTH
        ​​​​​​​Fernando

        Comment


        • #5
          Many thanks, Fernando; it worked.

          Comment

          Working...
          X