Dear all,

I am trying to replicate the market resiliency model used in the following paper: Bessembinder, Hendrik, Allen Carrion, Laura Tuttle, and Kumar Venkataraman. 2016. “Liquidity, Resiliency and Market Quality around Predictable Trades: Theory and Evidence.” Journal of Financial Economics 121 (1): 142–66. https://doi.org/10.1016/j.jfineco.2016.02.011.

More precisely, my focus is the following estimation p.154 (abridged for clarity):

Reported are estimates of the permanent price impact ( λ ), the temporary price impact ( γ ), and the resiliency of the market ( θ ) [...]
We estimate these parameters with geometric lag regressions of the form:

Pt − Pt−1 = β0 qt + β1 qt−1 + β2 qt−2 + β3 qt−3 + . . . .. + βt q0 + γ0 [Dt − Dt−1] (14)

where Pt is the time t trade price, qj is the signed order imbalance at time j , and the coefficients are restricted such that: β1 = γ (θ – 1), β2 = β1 θ , β3 = β1 θ2 , β4 = β1 θ3 , and so on. The number of lags ( j ) is set to 30. To allow for asymmetry permanent price impact of buy and sell imbalance, we estimate β0 = ( λB St + λS (1 − St) )+ γ where St equals one if qt > 0, and equals zero otherwise.

[...]

The geometric lag Eq. (12) is estimated by Generalized Method of Moments (GMM), using SAS Proc Model with a Bartlett Kernel set equal to the lag length plus one. Reported are Hansen’s J statistic test (and the corresponding p-value) of the null hypothesis that the over-identifying restrictions of the model are valid.
With Eq. (12) being (p.152):

The proportion of the price impact of a time t trade that persists to period t + n can be summarized by an “Impact Persistence” parameter, defined here as:
IPn = In / I0 = (λ + γ θn) / (λ + γ) (12)
So the four interesting parameters λB, λS, γ, γ0 and θ are estimated from the restrictions on the regression parameters.

I came to the following code:

Code:
gmm (eq1: d.price - {xb: L(0/29).order_imbalance} - {gma_0} * initiation_difference) ///
    (eq2: xb_L0.order_imbalance - ({lambda_b} * St + {lamba_s} * (1-St) + {gma})) ///
    (eq3: xb_L1.order_imbalance - ({gma} * ({theta}-1))) ///
    (eq4: xb_L2.order_imbalance - ({gma} * ({theta}-1)) * {theta}) ///
    (eq5: xb_L3.order_imbalance - ({gma} * ({theta}-1)) * {theta}^2) ///
    (eq6: xb_L4.order_imbalance - ({gma} * ({theta}-1)) * {theta}^3) ///
    (eq7: xb_L5.order_imbalance - ({gma} * ({theta}-1)) * {theta}^4) ///
    (eq8: xb_L6.order_imbalance - ({gma} * ({theta}-1)) * {theta}^5) ///
    (eq9: xb_L7.order_imbalance - ({gma} * ({theta}-1)) * {theta}^6) ///
    (eq10: xb_L8.order_imbalance - ({gma} * ({theta}-1)) * {theta}^7) ///
    (eq11: xb_L9.order_imbalance - ({gma} * ({theta}-1)) * {theta}^8) ///
    (eq12: xb_L10.order_imbalance - ({gma} * ({theta}-1)) * {theta}^9) ///
    (eq13: xb_L11.order_imbalance - ({gma} * ({theta}-1)) * {theta}^10) ///
    (eq14: xb_L12.order_imbalance - ({gma} * ({theta}-1)) * {theta}^11) ///
    (eq15: xb_L13.order_imbalance - ({gma} * ({theta}-1)) * {theta}^12) ///
    (eq16: xb_L14.order_imbalance - ({gma} * ({theta}-1)) * {theta}^13) ///
    (eq17: xb_L15.order_imbalance - ({gma} * ({theta}-1)) * {theta}^14) ///
    (eq18: xb_L16.order_imbalance - ({gma} * ({theta}-1)) * {theta}^15) ///
    (eq19: xb_L17.order_imbalance - ({gma} * ({theta}-1)) * {theta}^16) ///
    (eq20: xb_L18.order_imbalance - ({gma} * ({theta}-1)) * {theta}^17) ///
    (eq21: xb_L19.order_imbalance - ({gma} * ({theta}-1)) * {theta}^18) ///
    (eq22: xb_L20.order_imbalance - ({gma} * ({theta}-1)) * {theta}^19) ///
    (eq23: xb_L21.order_imbalance - ({gma} * ({theta}-1)) * {theta}^20) ///
    (eq24: xb_L22.order_imbalance - ({gma} * ({theta}-1)) * {theta}^21) ///
    (eq25: xb_L23.order_imbalance - ({gma} * ({theta}-1)) * {theta}^22) ///
    (eq26: xb_L24.order_imbalance - ({gma} * ({theta}-1)) * {theta}^23) ///
    (eq27: xb_L25.order_imbalance - ({gma} * ({theta}-1)) * {theta}^24) ///
    (eq28: xb_L26.order_imbalance - ({gma} * ({theta}-1)) * {theta}^25) ///
    (eq29: xb_L27.order_imbalance - ({gma} * ({theta}-1)) * {theta}^26) ///
    (eq30: xb_L28.order_imbalance - ({gma} * ({theta}-1)) * {theta}^27) ///
    (eq31: xb_L29.order_imbalance - ({gma} * ({theta}-1)) * {theta}^28), ///
    xtinstruments(eq2 eq31: order_imbalance, lags(0/29)) wmatrix(hac bartlett 31)
The output for this code is: "option winitial() invalid, r(198)". Unfortunately I don't really see how the rgmm section about winitial relates to my problem.

GMM estimation is totally new to me. I spent a lot of time in textbooks and introductory material recently, but I'm still learning on the go. Am I even going in the right direction with the gmm command and this series of equations?

Thanks in advance for any feedback!