Announcement

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

  • bootstrap for panel data

    Dear All, I modify a code to test the significance of product of two coefficients from two panel data models. The code is
    Code:
    webuse grunfeld, clear
    xtset, clear
    
    capture program drop xt_prod
    program define xt_prod, rclass
        xtset company     
        xtreg invest mvalue, fe robust
        local a = _b[mvalue]
        xtreg invest kstock, re robust
        local b = _b[kstock]
        return scalar prod = `a'*`b'
        exit
    end
    
    bootstrap prod = r(prod), reps(100) cluster(company) idcluster(ID): xt_prod
    1. Just for illustration, the first one is a fixed effect model, while the second one is a random effect model.
    2. The end is to test whether the product of the coefficient of mvalue in the first model and that of kstock in the second model is statistically significant.
    Any suggestions or comments are highly appreciated.
    Ho-Chuan (River) Huang
    Stata 19.0, MP(4)

  • #2
    The output of -bootstrap- gives you the estimated value of the product (in the Observed Coef. column of the table) as well as a z-statistic and a P-value. Assuming you want to do a significance test of the null hypothesis that the observed coefficient is zero, the z-statistic gives you the test and the P>|z| value gives you the p-value of that test. When I ran your code I got p = 0.004. (You might get a slightly different result because the code did not set the random number seed.)

    Comment


    • #3
      Dear Clyde, Thanks for the confirmation. In fact, I modified the code following your prior suggestion.
      Ho-Chuan (River) Huang
      Stata 19.0, MP(4)

      Comment

      Working...
      X