EconBase
← Back to paper

Estimation of Dynamic Panel Threshold Model using Stata

Extracted main text — title through conclusion, appendix excluded. This is what our citation measures are computed over, published so the extraction can be checked by eye.

33,325 characters · 12 sections · 0 citation commands

Rendered from LaTeX for readability, not typeset faithfully. Citation keys are highlighted; maths is left as source; figures, tables and equation environments are summarised rather than reproduced; unrecognised commands are greyed out so nothing is silently dropped. Email addresses are removed.

Estimation of Dynamic Panel Threshold Model using Stata

\affil[a]{ Department of Economics, Seoul National University} \affil[b]{ Department of Economics, University of Maryland} \affil[c]{ Department of Economics, Hongik University}

abstractWe develop a Stata command xthenreg to implement the first-differenced GMM estimation of the dynamic panel threshold model, which Seo and Shin (2016, Journal of Econometrics 195: 169-186) have proposed. Furthermore, We derive the asymptotic variance formula for a kink constrained GMM estimator of the dynamic threshold model and include an estimation algorithm. We also propose a fast bootstrap algorithm to implement the bootstrap for the linearity test. The use of the command is illustrated through a Monte Carlo simulation and an economic application.

\affil[a]{Department of Economics, Seoul National University}

\affil[b]{Department of Economics, Hongik University}

Introduction

The panel model with threshold effects in Hansen (1999) has been widely used in the empirical research. Hansen's fixed effect estimator has been applied to applications on the investment decision of firms under financial constraints, the relation between fiscal deficit and economic growth (Adam and Bevan 2005), inflation and growth (Khan and Ssnhadji 2001) and others. The threshold effect in the model allows for the asymmetric effect of the exogeneous variables depending on whether the threshold variable is above or below the unknown threshold. The threshold variable is typically dictated by the economic model. For instance, in the investment decision problem the size of the firm is often considered as a candidate threshold variable. Wang (2015) has developed Stata command xthreg to compute Hansen's estimator.

Hansen's (1999) model is static and his fixed effect estimator requires the covariates to be strongly exogeneous for the estimator to be consistent. However, the strong exogeneity can be restrictive in many real applications. Thus, the model has been extended to the dynamic panel model with a potentially endogenous threshold variable by Seo and Shin (2016). Their model allows for the lagged dependent variables and endogeneous covariates. Indeed, various applications of Hansen's fixed effect estimation can benefit from dynamic modeling. For instance, the investment decision depends on the previous period's investment and the panel threshold autoregressive model is another example of dynamic models.

We develop Stata commands for the first-differenced generalized method of moments (GMM) estimators and the associated asymptotic variance estimator that are proposed by Seo and Shin (2016) as well as the linearity testing to test for the presence of a threshold effect. While the previous command xthreg computes the fixed-effect estimator and thus it is not consistent under this general setting, our command xthenreg produces a consistent and asymptotically normal estimates.

In addition, we propose a computationally more attractive bootstrap algorithm to implement the linearity test than the nonparametric i.i.d. bootstrap that is originally proposed by Seo and Shin (2016). Furthermore, we present a constrained GMM estimator that reflects the kink restriction that has become more popular recent years, as in e.g. Zhang et al. (2017), along with its asymptotic variance formula and a consistent estimator.

The paper is organized as follows. Section 2 introduces the dynamic threshold panel model and the first-differenced GMM estimator. It also presents the asymptotic variance formula for a kink constrained estimator and a bootstrap algorithm for the linearity test. Section 3 explains the command xthenreg. Its use is illustrated in Section 4 and 5 through Monte Carlo simulations and an application. Section 6 concludes.

Model

The dynamic panel threshold model is given by

equation*[equation* omitted — 171 chars of source]

where $x_{it}$ may include lagged dependent variables and $q_{it}$ is the threshold variable. We assume $T$ is fixed while the sample size $n$ grows to infinity. Thus, we remove the incidental parameter $\mu _{i}$ by the first difference transformation and estimate the unknown parameters $\theta =\left( \beta ^{\prime },\delta ^{\prime },\gamma \right) ^{\prime }$ through the GMM. The following describes the GMM method as in Seo and Shin (2016).

Specifically, set an $l$-dimensional vector of instrument variables, $\left( z_{it_{0}}^{\prime },....,z_{iT}^{\prime }\right) ^{\prime }$ from the lagged variables and exogenous variables, where $2<t_{0}\leq T.$ Next, construct the sample moment

equation*[equation* omitted — 304 chars of source]

where

equation[equation omitted — 443 chars of source]

with $\Delta $ signifying the first difference operator and

equation*[equation* omitted — 335 chars of source]

Then, introduce the GMM criterion function with a weight matrix $W_{n},$

equation[equation omitted — 144 chars of source]

which is minimized to produce a GMM estimate $\hat{\theta}$.

The minimization is done by the grid search since for each fixed $\gamma$ the model becomes the linear panel with a fixed effect, which yields the closed-form solution

equation[equation omitted — 315 chars of source]

and the criterion function $\bar{J}_{n}\left( \theta \right) $ is a step function over $\gamma $ with at most $nT$ jumps. However, it is worthwhile to note that this algorithm is different from splitting the sample into two and applying the linear GMM for each partitioned sample.

For the weight matrix, either $W_{n}=I_{l}$ or

equation[equation omitted — 560 chars of source]

was proposed in the first step and it is updated to

equation[equation omitted — 189 chars of source]

where $\hat{g}_{i}=\left( \widehat{\Delta \varepsilon }_{it_{0}}z_{it_{0}}^{ \prime },...,\widehat{\Delta \varepsilon }_{iT}z_{iT}^{\prime }\right) ^{\prime }$ and $\widehat{\Delta \varepsilon }_{it}$ is the residual from the first step estimation.

It was shown by Seo and Shin (2016) that under suitable regularity conditions \footnote{ One of the conditions allows for $\delta _{0}$ to be both fixed and shrinking toward zero at $ n^{-\alpha }.$} the GMM estimator is asymptotically normal. Specifically,

equation*[equation* omitted — 323 chars of source]

where $G=\left( G_{\beta },G_{\delta }\left( \gamma _{0}\right) ,G_{\gamma }\left( \gamma _{0}\right) \right) $ with

equation*[equation* omitted — 553 chars of source]

and

equation*[equation* omitted — 648 chars of source]

where $\mathrm{E}_{t}\left[ \cdot |\gamma \right] $ denotes the conditional expectation given $q_{it}=\gamma $ and $p_{t}\left( \cdot \right) $ denotes the density of $q_{it}.$

The estimation of the asymptotic variance is standard, that is,

equation*[equation* omitted — 259 chars of source]

where $g_{i}\left( \theta \right) =g_{1i}+g_{2i}\left( \gamma \right) \left( \beta ^{\prime },\delta ^{\prime }\right) ^{\prime }$, and

equation*[equation* omitted — 498 chars of source]
equation[equation omitted — 601 chars of source]

which is the Nadaraya-Watson kernel estimator for some kernel $K$ and bandwidth $h$ such as the Gaussian kernel and Silverman's rule of thumb. We plug in $\theta =\hat{\theta}$.

Kink Model

Although the threshold model typically implies the presence of a discontinuity of the regression function, it may mean the presence of a kink not a jump if $\left( 1,x_{it}^{\prime }\right) \delta =\kappa \left( q_{it}-\gamma \right) $ for some $\kappa $. It happens when one element of $ x_{it}$ is $q_{it}$ with the coefficient $\kappa $ and the first element of $ \delta $ equals to $-\gamma \kappa .$ Under these restrictions, the model becomes

equation*[equation* omitted — 170 chars of source]

Even when the true model is a kink one, it is shown that the asymptotic distribution of the GMM estimator in the preceding section is valid. This is in contrast to the least squares estimator for the linear regression, for which Hidalgo et al. (2019) have shown that the cube root phenomenon appears.

The asymptotic distribution of the constrained GMM estimator of $(\beta ,\kappa ,\gamma )$ that imposes the kink restriction can also be derived for the same reasoning as in Seo and Shin (2016). Specifically, the asymptotic variance is given by redefining $G=\left( G_{\beta },G_{\kappa },G_{\gamma }\right) ,$ where $G_{\beta }$ is the same as above and

eqnarray*[eqnarray* omitted — 620 chars of source]

The estimation of these terms is analogous to that of $G_{\delta }$ and $ G_{\gamma }$ in the preceding section.

Bootstrap Test of Linearity

This section proposes a fast bootstrap algorithm to test for the presence of the threshold effect, that is, the null hypothesis

equation[equation omitted — 95 chars of source]

where $\Gamma $ denotes the parameter space for $\gamma $, against the alternative hypothesis

equation*[equation* omitted — 90 chars of source]

A standard approach is to employ a supremum type statistic to take care of the loss of identification under the null, that is,

equation*[equation* omitted — 92 chars of source]

where $\mathcal{W}_{n}\left( \gamma \right) $ is the standard Wald statistic for each fixed $\gamma $, that is,

equation[equation omitted — 200 chars of source]

where $\hat{\delta}\left( \gamma \right) $ is the GMM estimator of $\delta $ for a given $\gamma $, and

equation*[equation* omitted — 171 chars of source]

a consistent asymptotic variance estimator, where $R=\left( \mathbf{0} _{\left( k_{1}+1\right) \times k_{1}}\mathbf{,}I_{k_{1}+1}\right) ,$ and $ \hat{V}_{s}\left( \gamma \right) =\hat{\Omega}\left( \hat{\theta}\left( \gamma \right) \right) ^{-1/2}\left( \hat{G}_{\beta },\hat{G}_{\delta }\left( \hat{\theta}\left( \gamma \right) \right) \right) $.

Since the asymptotic distribution is not pivotal, we propose a bootstrap algorithm, which is faster than the i.i.d. bootstrap proposed in Seo and Shin (2016). Specifically,

enumerate• Draw $\left\{ \eta _{i}\right\} _{i=1}^{n}$ independently from the standard normal. • Recall the definition of $\hat{\delta}\left( \gamma \right) $ in ((ref)) and compute $\hat{\delta}\left( \gamma \right) ^{\ast }$ by replacing $\Delta y_{it}$ with $\Delta y_{it}^{\ast }=\widehat{\Delta \varepsilon _{it}}\eta _{i}$, where $\widehat{\Delta \varepsilon _{it}} =\Delta y_{it}-\Delta x_{it}^{\prime }\hat{\beta}-\hat{\delta}^{\prime }X_{it}^{\prime }\mathbf{1}_{it}\left( \hat{\gamma}\right) $ is the residual from the original sample. • Compute a bootstrap statistic $\mathcal{W}_{n}^{\ast }(\gamma )=n\hat{ \delta}\left( \gamma \right) ^{\ast \prime }\hat{\Sigma}_{\delta }\left( \gamma \right) ^{-1}\hat{\delta}\left( \gamma \right) ^{\ast }$ and its supremum over $\Gamma $ to get $\text{supW}^{\ast }$. • Repeat step 1-3 $B$ times and compute the empirical proportion of supW$ ^{\ast }$ bigger than supW.

Command

Syntax

\hangindent=1em xthenreg $depvar$ $indepvars$ [$if$] [$in$] \newline [, endogenous($varlist$) inst($varlist$) kink static \newline \texttt{grid_num}($integer$ 20) \texttt{trim_rate}($real$ 0.4) \texttt{h_0}($real$ 1.5) \texttt{boost}($real$ 0)]\\

where $depvar$ is the dependent variable and $indepvars$ are the independent variables. There are several comments for users.

enumerate• xtset should be done before running this. Moreover variables must be sorted by (i) panel variable and (ii) time variable beforehand. • Strongly balanced panel data is required. • Inputs should be put as y q x1 x2 $\cdots$, where q is the threshold variable and x1 x2 $\cdots$ are other independent variables. • moremata library is required since this command use mm_quantile function. • When there are endogeneous independent variables, $\texttt{\underline{endo}genous}$ option should be set. For example, if \texttt{x1} is exogeneous and \texttt{x2} is endogeneous, the input must be \texttt{y q x1, endo(x2)}.

Options

endogenous($varlist$) specifies endogeneous independent variables. The endogeneous variables must be excluded from the list of independent variables before the comma.\\\\ inst($varlist$) specifies the list of additional instrumental variables. \\\\ static sets the model static. The default model is dynamic. In contrast with dynamic model, static model does not automatically include L.y as independent variable. \\\\ kink sets the model kink. \\\\ grid_num($integer$) determines the number of grid points to estimate the threshold $\gamma$. The default is 20.\\\\ \texttt{trim_rate}($real$) determines the trim rate when constructing a grid for estimating r. The default is 0.4.\\\\ \texttt{h_0}($real$) determines a parameter for Silverman's rule of thumb used to kernel estimation. The default is 1.5.\\\\ \texttt{boost}($integer$) The number of bootstrapping for linearity test. The default is 0.\\

Stored Results

xthenreg stores the following results in e( ):\\\\ Scalars

itemize• e(N) The number of units of panel data • e(T) The time length of panel data • e(boots_p) $p\textit{-}value$ for bootstrap linearity test. -1 if the test is not used • e(grid) The number of grid points used • e(trim) The trim rate for grid search • e(bs) The number of bootstrapping

Macros

itemize• e(zx) The name of instrumental variables • e(qx) The name of the threshold variable • e(depvar) The name of the dependent variable • e(indepvar) The name of the independent variable(s) • e(properties) The name of coefficient matrix and covariance matrix

Matrices

itemize• e(b) Estimates of coefficients • e(V) The estimate of the covariance matrix • e(CI) $95\%$ asymptotic confidence interval for b

Monte Carlo experiments

In this section we illustrate the finite sample performance of the bootstrap linearity test. Some simulations for estimation were performed in Seo and Shin (2016). Here the model under $\mathcal{H}_0$ is linear, i.e. $\delta = 0$. We consider the following data generating process. Specific values of coefficients are different across simulations. \[

split[split omitted — 169 chars of source]

\] We summarize more details of our simulation design in the following table.

table[table omitted — 332 chars of source]

Moreover, $x_{i, t}$ and $\varepsilon_{i, t}$ were drawn independently from the centered normal distribution with standard deviation 1 and 0.25 respectively. For each iteration, we calculate bootstrap $sup \, W^{\ast }$ once following e.g. Giacomini et al. (2013). Consequently, we obtain 500 simulated $sup \, W$ and $sup \, W^{\ast }$ statistics. With this we compute the bootstrap critical value, which is the empirical $\left( 1-\alpha \right) 100$-percentile of those 500 $sup \, W^{\ast }$ statistics, and the rejection probability for the given $\alpha $, which is the proportion of 500 $sup \, W$ statistics bigger than the bootstrap critical value.

Test size

Here we impose $(\beta_1, \beta_2, \delta_0, \delta_1, \delta_2) = (0.5, 0.8, 0.0, 0.0, 0.0)$ so that $\mathcal{H}_0: \delta = 0$ holds. This implies the true underlying model is linear. The simulated rejection probability was $0.066$ which is reasonably close to the true $\alpha=0.05$. Empirical distributions of $sup \, W$ and $sup \, W^*$ are as follow.

figure[figure omitted — 164 chars of source]

Test power

Here we tested three sets of coefficient choices, maintaining $\mathcal{H}_1: \delta \neq 0$ holds.

table[table omitted — 316 chars of source]

We observe that our test has significant power to reject $\mathcal{H}_0$ when $\mathcal{H}_1$ is true, especially when the true $\delta$ is sufficiently far from zero.

Application

We apply our method to evaluate the effect of obesity on worker's productivity. Obesity is measured with Body Mass Index (BMI), weight in kilograms divided by height in meters squared. Individuals whose BMI between 25 and 30 are considered to be overweight, and BMI of 30 or higher are treated as obese. Using data from the British Cohort Study and the methods described in the earlier section, we examine how BMI is associated with work hours. For more detailed discussion, see Kim (2019).

In this example, we consider work hours and BMI of male workers using the following model with a kink in BMI.

equation*[equation* omitted — 146 chars of source]

where we present work hours as $y_{it}$ for an individual $i$ for a period $ t,$ $x_{it}$ is family size and $q_{it}$ is BMI. We have two period panel data $(t=1,2)$ and take the first difference as follows to remove $\alpha _{i},$ the individual time-invariant charateristics that are associated with work hours.

equation*[equation* omitted — 198 chars of source]

To implement GMM estimation, we use four instrumental variables, birth weight (bweight) and a worker's own childhood BMI (bmic) and parents' BMI (bmim, bmid), for BMI variables of $\Delta q_{i2},q_{i2},q_{i1}$ in the first differenced model.

After loading data, we first need to declare that the data is panel. The default model for xthenreg is a dynamic model. Since we consider a static model, not a dynamic model, we use static option. We also impose a kink in the model by using kink option.

quotation. use hour, clear\newline . xtset ilabel time\newline . xthenreg hour bmi hsize, endo(bmi) inst({ bweight \TEXTsymbol{>} \ bmic bmim bmid hsize}) kink static\newline \newline N = 768, T = 2\newline Panel Var. = ilabel\newline Time Var. = time\newline \texttt{Number of moment conditions = 7}
center[center omitted — 878 chars of source]

The information preceding the table is as follows. N is the total number of unique subjects, T is the number of time periods. Number of moment conditions is provided based on the choice of instruments. In this example, we can obtain the same results by collecting all exogenous variables into one place with exo option as follows.

quotation{ . xthenreg hour bmi, endo(bmi) exo(hsize) inst(bweight \TEXTsymbol{>} \ bmic bmim bmid) kink static }

We can also change the set of included and excluded instruments using the inst option. The number of moment conditions varies accordingly.

quotation{ . xthenreg hour bmi hsize, endo(bmi) inst(bweight \TEXTsymbol{>} \ bmic bmim bmid) kink static } N = 768, T = 2\newline Panel Var. = ilabel\newline Time Var. = time\newline Number of moment conditions = 6
center[center omitted — 776 chars of source]

We can estimate the model with a restriction on the sample.

quotation{ . xthenreg hour bmi if region==1, endo(bmi) exo(hsize) \TEXTsymbol{>} \ inst(bweight bmic bmim bmid) kink static } N = 637, T = 2\newline Panel Var. = ilabel\newline Time Var. = time\newline Number of moment conditions = 7
center[center omitted — 780 chars of source]

Next we consider discontinuity in BMI effect without imposing a kink in the model.

equation*[equation* omitted — 168 chars of source]

By taking first difference, we obtain the following model and estimate it with only static option.

equation*[equation* omitted — 242 chars of source]
quotation{ . xthenreg hour bmi, endo(bmi) exo(hsize) inst(bweight \TEXTsymbol{>} \ bmic bmim bmid) static } N = 768, T = 2\newline Panel Var. = ilabel\newline Time Var. = time\newline Number of moment conditions = 7
center[center omitted — 954 chars of source]
thebibliography{9} \bibitem{Adam} Adam, C. S., and Bevan, D. L. (2005). “Fiscal deficits and growth in developing countries,” Journal of Public Economics, 89(4), 571-597. \bibitem{Giacomini} Giacomini, R., Politis, D. N., & White, H. (2013). “A warp-speed method for conducting Monte Carlo experiments involving bootstrap estimators,” Econometric theory, 29(3), 567-589. \bibitem{Han99} Hansen, B. E. (1999). “Threshold effects in non-dynamic panels: Estimation, testing, and inference,” Journal of econometrics , 93(2), 345-368. \bibitem{HLS} Hidalgo, J., Lee, J., and M.H. Seo (2019). “Robust Inference for Threshold Regression Models,” Journal of Econometrics, to appear. \bibitem{Khan} Khan, M. S., and Ssnhadji, A. S. (2001). “Threshold effects in the relationship between inflation and growth,” IMF Staff papers, 48(1), 1-21. \bibitem{Kim and Daly} Kim, Y-J. (2019). “The effect of weight on work hours,” working paper. \bibitem{SeoShin16} Seo, M. and Y. Shin (2016). “Dynamic panels with threshold effect and endogeneity,” Journal of Econometrics, 195: 169-186. \bibitem{Wang} Wang, Q. (2015). “Fixed-effect panel threshold model using Stata,” \emph{The Stata Journal}, 15(1), 121-134. \bibitem{ZZZ} Zhang, Y., Zhou, Q., and Jiang, L. (2017). “Panel kink regression with an unknown threshold,” \emph{Economics Letters}, 157, 116-121.