where xit are a vector of control variables. Note you also have to include time effects βt (time dummies). Let ˆdit be the fitted values from this estimation. Second, apply lasso (gamlr) to estimate yit = α + βt + γdit + δd.napit + φ(ˆdit × t.napt) + x0itπ +...