*! version 1.0.1
help xtendothresdpd

Title

Performs Estimations of a Dynamic Panel Data Threshold Effects Model with Endogenous Regressors

Syntax

xtendothresdpd
depvar
indepvars
[if] [in]
, thresv(varname) stub(string) pivar(varname) dgmmiv(varlist [...]) [options]

* thresv(varname) indicates the threshold variable

* stub(string) designates a string name from which new variable names will be created

* pivar(varname) is the variable that depends on the threshold

* dgmmiv(varlist[...]) GMM-type instruments
for the difference equation; can be specified more than once

fpctile(#) specifies the lower bound percentile of the threshold variable

lpctile(#) specifies the upper bound percentile of the threshold variable

xaddendog(varlist) list of additional endogenous variables correlated with the error term

sig(#) designates the significance level we want to set for the confidence interval for the estimated threshold

zaddinst(varlist) list of additional instrumental variables for the intermediate computations

nographs removes the display of the graphic after the estimations are performed

saving(string) allows to save the graphic that the command creates

grid(#) designates the number of grid points used to estimate the threshold

forcereg this option explicitly balances the panel data before the estimation

lagsret(#) indicates the number of lags of the lagged dependent variable to use as instruments for the intermediate computations

xtdpd_options in addition to the options listed above, all options of the command [XT] xtdpd
can be used

* thresv(), stub(), pivar() and dgmmiv() are required.

You must tsset or xtset your data before using xtendothresdpd;
see [TS] tsset and [XT] xtset.

depvar is the dependent variable and indepvars are the regime-independent variables.

depvar, indepvars, and all varname and varlist may contain time-series operators; see tsvarlist.

by is allowed with xtendothresdpd; see [D] by for more details on by.

Description

xtendothresdpd performs estimations of a dynamic panel data threshold effects model with endogenous regressors. If we have a
panel data model which is dynamic, meaning that we have the dependent variable and its lagged value in the model. If, in this
model, we also have a threshold effect and the regressors are endogenous, then we can use the command xtendothresdpd
to estimate both the threshold effect and the slope coefficients. In this command, the threshold is determined endogenously. That
is, if there is a threshold, the command finds it by using the information given by the data. The theory behind the
command xtendothresdpd is provided by Kremer, Bick and Nautz (2013).

Econometric Model

The general equation to be estimated is given by:

y_it = psi*y_ + beta_1*pi_it*I(q_it <= gamma) + beta_2*pi_it*I(q_it > gamma) + phi_1'*x_{1 it} + phi_2'*x_{2 it} + mu_i + epsilon_it (1)

where

p_it = (y_ x_{2 it})'

y_it is the dependent variable

y_ is the lagged dependent variable

pi_it is the variable that depends on the threshold (regime dependent variable)

q_it is the threshold variable

gamma is the threshold parameter to be estimated

I(.) is the indicator function

x_{1 it} vector of exogenous variables uncorrelated with epsilon_it (first set of regime independent variables)

x_{2 it} vector of endogenous variables correlated with epsilon_it (second set of regime independent variables)

p_it is the vector of all endogenous variables

mu_i are the fixed effects

epsilon_it are the idiosyncratic errors

psi, beta_1, beta_2, phi_1', phi_2' are parameters to be estimated

i = 1,...,N and t = 1,...,T

We will also need the following equations to understand the command xtendothresdpd:

LR(gamma) = (S(gamma) - S(gamma_hat))/sigma_hat^2 (2)

C(alpha) = -2*ln(1-sqrt(1-alpha)) (3)

GAMMA = LR(gamma) <= C(alpha) (4)

with

C(alpha) is the alpha percent, percentile of the asymptotic distribution of the
likelihood ratio statistic LR(gamma)

LR(gamma) the likelihood ratio statistic

S(gamma) the sum of squared errors of the Second Stage of Estimation at gamma

S(gamma_hat) the sum of squared errors of the Second Stage of Estimation at gamma_hat

sigma_hat^2 the residual variance at gamma_hat

The correspondence between the econometric models given in equations (1), (2), (3), (4) and
the syntax of the command xtendothresdpd is given as follows:

depvar corresponds to y_it

L.depvar corresponds to y_

pivar(varname) corresponds to pi_it

thresv(varname) corresponds to q_it

indepvars corresponds to x_{1 it}

xaddendog(varlist) corresponds to x_{2 it}

sig(#) corresponds to alpha

LR(gamma), C(alpha) and expression (4) are used for the Confidence Interval Construction for
the Threshold Model. These objects are graphed in the graphic that appears after the estimations are performed if
the nographs option is not specified

Options

thresv(varname) indicates the threshold variable. To form this option,
you put inside the parentheses the variable name representing the threshold variable.
You must specify this option in order to get a result. Hence this option is required.

stub(string) designates a string name from which new variable names will be
created. To form this option, you put inside the parentheses a string name (without the
double quotes). Then new variable names will be created from this string. You must
specify this option in order to get a result. Hence this option is required.

pivar(varname) is the variable that depends on the threshold (regime dependent variable). To form
this option, you put inside the parentheses the name of the variable that depends on
the threshold variable. This variable may be the same as the threshold variable or it
may be different from the threshold variable. You must specify this option in order
to get a result. Hence this option is required.

dgmmiv(varlist [, lagrange(flag
[llag])]) specifies GMM-type instruments for the
difference equation. Levels of the variables are used to form GMM-type
instruments for the difference equation. All possible lags are used,
unless lagrange(flag llag) restricts the lags to
begin with flag and end with llag. You may specify as many sets
of GMM-type instruments for the difference equation as you need within the
standard Stata limits on matrix size. Each set may have its own flag
and llag. dgmmiv() is required. dgmmiv() is one of the
options of the command [XT] xtdpd. See
xtdpd_options below for more details.

fpctile(#) specifies the lower bound percentile of the threshold variable that
must be included in the search for gamma. The default value of this option is 10.
Hence the search for gamma starts at the 10th percentile of the threshold variable.

lpctile(#) specifies the upper bound percentile of the threshold variable that
must be included in the search for gamma. The default value of this option is 90.
Hence the default search for gamma starts at the 10th percentile and goes up to the 90th
percentile of the threshold variable. Thus the options fpctile(#) and lpctile(#)
determine the interval that is used when constructing a grid for estimating
gamma. That is, with the default values for these two options, the values below and above
the 10th and the 90th percentile of the threshold variable are eliminated and only the values
between the 10th and the 90th percentile of the threshold variable are utilized for the
grid search for gamma.

xaddendog(varlist) list of additional endogenous variables correlated with
the error term. These variables represent the second set of regime independent variables. If you
have any additional endogenous variables, you put them in this option. To form this option, you
put inside the parentheses one, two or more of your additional endogenous variables separated by space.

sig(#) designates the significance level we want to set for the confidence interval for the
estimated threshold. The default value of this option is 0.10. This default value of 0.10 means
that we want a 90 percent confidence interval for the estimated threshold parameter.

zaddinst(varlist) list of additional instrumental variables used for the intermediate
computations by the command xtendothresdpd. Note that the use of the option
zaddinst(varlist) does not prevent employing the numerous instrumental variables
options of the command [XT] xtdpd (see xtdpd_options below for more details).
Hence the option zaddinst(varlist) may or may not be used in conjunction with the
instrumental variables options of the command [XT] xtdpd. The instrumental variables options
of the command [XT] xtdpd are employed for the final computations while the
zaddinst(varlist) option is utilized for the intermediate calculations. To form the
option zaddinst(varlist), you put inside the parentheses one, two or more
of your additional instrumental variables separated by space. Contrarily to the options of the
command [XT] xtdpd, the option zaddinst(varlist) may be only
specified once. If you have any additional instrumental variables for the intermediate computations,
you put them in the option zaddinst(varlist).

nographs suppresses the display of the graphic after the estimations are performed. This
option is used when we do not want to display the graphic after the estimations are done.

saving(string) in this option, you specify the complete file path where you want to save the
graphic produced by the command. You must enclose the path in double quotes. If you do not
specify this option, the graphic will be displayed, if you do not choose the nographs
option, but it will not be saved.

grid(#) designates the number of grid points used to estimate the threshold. The default
value of this option is 400. This default value means that 400 quantiles are used as a grid in
computing the threshold.

forcereg explicitly balances the panel data before the estimation. The command xtendothresdpd
works for both unbalanced panel data and strongly balanced panel data. Generally, the option forcereg is for
specific use when you are utilizing the fodeviation option of the command [XT] xtdpd
(see xtdpd_options below for more details). In fact, the option fodeviation is
not allowed when there are gaps in the data or when lgmmiv() option
(from the command [XT] xtdpd) is specified. Hence, if your panel data is unbalanced,
and you want to employ the fodeviation option, then use it in conjunction with the option
forcereg. You can also use the forcereg option if you desire to strongly balance your
panel data before performing the estimation.

lagsret(#) indicates the number of lags of the lagged dependent variable to use as instruments
for the intermediate computations. The default value of this option is 1. This default value means
that only the first lag of the lagged dependent variable is used as instrument for the intermediate
computations. Note that the use of the option lagsret(#) does not prevent employing the numerous
instrumental variables options of the command [XT] xtdpd (see xtdpd_options
below for more details). Hence the option lagsret(#) may be used in conjunction with the instrumental
variables options of the command [XT] xtdpd. The instrumental variables options of the command
[XT] xtdpd are employed for the final computations while the lagsret(#) option is utilized
for the intermediate calculations. Contrarily to the options of the command [XT] xtdpd, the
option lagsret(#) may be only specified once.

xtdpd_options:
dgmmiv(varlist[...]),
lgmmiv(varlist[...]),
iv(varlist[...]),
div(varlist[...]),
liv(varlist),
noconstant,
twostep,
hascons,
fodeviation,
vce(vcetype),
level(#), etc.
See [XT] xtdpd.
In addition to the options described above, all options of the [XT] xtdpd command can be used.

You can use all the options of the command [XT] xtdpd. To utilize them with the
command xtendothresdpd, enter them in the same manner that you would do with
the [XT] xtdpd command. Hence, it is strongly advised that you read both all the
help file of the command xtendothresdpd (this help file), and all the help file of the
command [XT] xtdpd, including all of its complete PDF manual entry
at View complete PDF manual entry. This will help you to efficiently
employ the command xtendothresdpd.

Syntax for predict

predict
[type]
newvar
[if] [in]
[, xb e stdp difference]

Description for predict

predict creates a new variable containing predictions such as linear
predictions.

Options for predict

xb, the default, calculates the linear prediction.

e calculates the residual error.

stdp calculates the standard error of the prediction, which can be
thought of as the standard error of the predicted expected value or mean for
the observation's covariate pattern. The standard error of the prediction
is also referred to as the standard error of the fitted value. stdp may
not be combined with difference.

difference specifies that the statistic be calculated for the first
differences instead of the levels, the default.

Syntax for xtendothresdpdtest

xtendothresdpdtest
, comdline(string) [options]

Description for xtendothresdpdtest

xtendothresdpdtest allows us to test for a threshold after we perform the estimations with the command xtendothresdpd.
The command xtendothresdpdtest permits to find out if the threshold effect is statistically significant. The hypothesis of
no threshold effect in equation (1) can be characterized by the linear constraint:

H0: beta_1 = beta_2 (5)

Hence, the Null Hypothesis is that there is no threshold effect in equation (1) and the Alternative Hypothesis
is that there is a threshold effect in equation (1) . The test for the presence of a threshold effect is also known in
the literature as test of linearity. To test H0 in expression (5), we use an extension of the Davies (1977)
Sup test to the Dynamic Panel Data Threshold Effects Model with Endogenous Regressors framework. The statistic that allows
us to test for H0 in expression (5) is called SupWStar in the table of results of the
command xtendothresdpdtest. See the Examples section below for more details.

Options for xtendothresdpdtest

comdline(string) designates a string name representing the command line that was typed by the user when he was using
the command xtendothresdpd. You enter the command line in the option comdline(string) as: comdline(`e(cmdline)'). To
see the command line you typed when you were using the command xtendothresdpd, you can type ereturn list immediately
after you perform your estimations with the command xtendothresdpd. The option comdline(string) is required.

reps(#) specifies the number of replications to be performed. The default value of this option is 50.

simulopts(string) in this option, you specify a list of all the options allowed by
the [R] simulate command. To form them, enter inside the parentheses the options of
the [R] simulate command separated by blank spaces as you would do with
the [R] simulate command. See [R] simulate for more details.

bstatopts(string) in this option, you specify a list of nearly all the options allowed by
the [R] bstat command. Except the following options: stat(vector), n(#) which are
already used internally by the command xtendothresdpdtest, nearly all the other options of
the [R] bstat command can be included in the option bstatopts(string). To form
them, enter inside the parentheses the options of the [R] bstat command separated by blank spaces
as you would do with the [R] bstat command. See [R] bstat for more details.

Warning

The command xtendothresdpd, like many panel data threshold effects estimation techniques, is
highly computationally intensive and may for that reason take a very long time to run on a sluggish machine. The
command xtendothresdpdtest is far more computationally intensive than the
command xtendothresdpd. So, please, be patient when using both of these commands. The
command xtendothresdpdtest does not work when the option nographs is specified with the
command xtendothresdpd.

Important Advice

Please keep the stub(string) option you use with the command xtendothresdpd
very short as possible because Stata variables names must not exceed 32 characters and the
command internally employs already long names for the internal variables utilized in the internal
computations. As a suggestion and guideline, in the examples given below (see the Examples section below),
the stub(string) option contains only three (3) characters (three (3) letters).
Also , in your equation specification for the command xtendothresdpd, please put the name of
the lagged dependent variable always immediately after the name of the dependent variable as it is done
in the Examples section below. Additionally, contrarily to the command [XT] xtdpd which may
allow more than one lag of the dependent variable, only one lag of the dependent variable is allowed in
the equation specification of the command xtendothresdpd. See the Econometric Model section
above and the Examples section below for more details. Lastly, if the command xtendothresdpd aborts
with an error message before displaying the final results, you may need to clear Stata memory
(see for [D] clear more details) before running your next regression with the command xtendothresdpd.

Return values for xtendothresdpd

xtendothresdpd saves the following in e(). The command xtendothresdpd saves all the
Stored Results returned by the command [XT] xtdpd. So I advise you to look at the Stored
Results of the command [XT] xtdpd in conjunction with the Stored Results provided below
to see the descriptions and the explanations of all the Stored Results returned by the
command xtendothresdpd. Hence, in this help file, only the Stored Results that are not
given by the command [XT] xtdpd are explained. For the other remaining Stored
Results, please see the help file for the command [XT] xtdpd for more details:

Scalars

e(gammahat) value of the estimated threshold parameter

e(sofgammahat) the sum of squared errors of the Second Stage of Estimation at the estimated threshold parameter

e(sigmahatsq) the residual variance at the estimated threshold parameter

e(confalpha) is the alpha percent, percentile of the asymptotic distribution of the likelihood ratio statistic. This corresponds to C(alpha)

e(noptimal) number of groups at the estimated threshold parameter

e(toptimal) average group size at the estimated threshold parameter

e(lowbgamma) lower bound of the confidence interval of the estimated threshold parameter

e(uppbgamma) upper bound of the confidence interval of the estimated threshold parameter

e(firstpctz) the lower bound percentile of the threshold variable that must be included in the search for gamma. This corresponds to fpctile(#)

e(lastpctz) the upper bound percentile of the threshold variable that must be included in the search for gamma. This corresponds to lpctile(#)

e(alphaparam) the significance level we want to set for the confidence interval for the estimated threshold. This corresponds to sig(#)

e(gridpoints) the number of grid points used to estimate the threshold. This corresponds to grid(#)

Macros

e(lesoptionsdp) all the options of the command [XT] xtdpd that was typed by the user

e(thresvaribzha) the threshold variable that was typed by the user

e(pivaribzha) the variable that depends on the threshold (regime dependent variable) that was typed by the user

e(additendox) list of additional endogenous variables correlated with the error term that was typed by the user

e(additinstrz) list of additional instrumental variables used for the intermediate computations by the command xtendothresdpd that was typed by the user

e(gammavarzha) is the threshold parameter sequence. This corresponds to gamma

e(sofgammazha) the sum of squared errors of the Second Stage of Estimation at gamma sequence. This corresponds to S(gamma)

e(lrofgammazha) the likelihood ratio statistic sequence. This corresponds to LR(gamma)

e(subsetgammazha) subset of the gamma sequence used for the Confidence Interval Construction for the Threshold Model

e(belowthreszha) the regime dependent variable below the estimated threshold. This corresponds to pi_it*I(q_it <= gamma_hat)

e(abovethreszha) the regime dependent variable above the estimated threshold. This corresponds to pi_it*I(q_it > gamma_hat))

e(predict) program used to implement predict

e(cmd) name of command

e(cmdline) command as typed

Return values for xtendothresdpdtest

xtendothresdpdtest saves the following in e(). The command xtendothresdpdtest saves all the Stored Results
returned by the command [R] bstat. So I advise you to look at the Stored Results of the
command [R] bstat to see the descriptions and the explanations of all the Stored Results returned by the
command xtendothresdpdtest. Hence to avoid duplication, in this help file, I do not list any Stored Results
returned by the command xtendothresdpdtest because they are provided by the command [R] bstat. Thus
I advise you, please, to look at the help file for the command [R] bstat to see all the Stored Results
returned by the command xtendothresdpdtest.

Examples

Before beginning the estimations, we use the set more off instruction to tell
Stata not to pause when displaying the output.

set more off

We illustrate the use of the command xtendothresdpd with the dataset xtendothresdpddata.dta. This
dataset contains a sample of panel data for developed and developing countries in the World. It contains 8 periods of
5 non overlapping years from 1975-1979 to 2010-2014.

use http://fmwww.bc.edu/repec/bocode/x/xtendothresdpddata.dta, clear

Next we describe the dataset to see the definition of each variable.

describe

We regress the dependent variable (lggdppccstd) on the lagged dependent variable (L.lggdppccstd) and on the
regime independent variables (lginvestgdpr lginflation). We put the threshold variable (debtpcgdpr) in the option
thresv(). We put the string enr without the double quotes in the option stub(). We put the variable
that depends on the threshold (debtpcgdpr) in the option pivar(). In this specification, the threshold variable
and the variable that depends on the threshold are the same. We will relax this assumption in some other regressions
below. We put the GMM-type instruments for the difference equation (lggdppccstd) in the option dgmmiv(). We
indicate that we want to compute the two-step estimator with the option twostep. Finally, we specify that we
want the vcetype to be robust with the option vce(robust).

xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) twostep vce(robust)

We see that we have two tables of results. One big table (first table) and one small table (second table). In
the big table of results with the title Dynamic panel-data estimation, we notice that two more variables have been
generated: below_thres_enr and above_thres_enr. The variable below_thres_enr corresponds to the regime
dependent variable below the estimated threshold. This corresponds to pi_it*I(q_it <= gamma_hat). The variable
above_thres_enr corresponds to the regime dependent variable above the estimated threshold. This corresponds to
pi_it*I(q_it > gamma_hat)). The other variables in this big table correspond to the lagged dependent variable and
the regime independent variables. This big table have also headers and footers. The small table of results with tile
Threshold Parameter (level = 90) gives the statistics for the estimated threshold parameter (Gamma_Hat). The (level = 90)
means that the reported threshold parameter have a 90 percent confidence interval. The results in this small table
indicate that we have a threshold value of .30745 with lower bound confidence interval of .30192 and an upper
bound confidence interval of .319. The graphic indicates the Confidence Interval Construction for the Threshold
Model. In this graphic, the Blue curve represents the likelihood ratio statistic: LR(gamma). The Greene horizontal
line represents the alpha percent, percentile of the asymptotic distribution of the likelihood ratio statistic:
C(alpha). The intersection of the two curves in this graphic correspond to the confidence interval. The point at
which the Blue curve touches the x-axis corresponds to the estimated threshold parameter Gamma_Hat.

The estimations also generates additional variables that are thoroughly documented in the
Return values for xtendothresdpd section above and also explained by their respective labels. To see
these variables, we type:

des enr_* below_thres_enr above_thres_enr

From an Economics point of view, the results above illustrate that Debt over GDP divided by 100
has a negative and significant effect, in both below and above the threshold of .30745, on economic growth (see the big table and the small table). The
effect below the threshold is economically larger than that above the threshold (see the big table). The small table
shows that since 0 (zero) is not in the confidence interval for Gamma_Hat, the estimated threshold is
statistically significant at the 90 percent confidence interval.

In the next line, we estimate the same regression as above with the noconstant option.

xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) twostep vce(robust) noconstant

We show how to use the fpctile(#) and lpctile(#) options. In the next expression, the search
for gamma starts at the 5th percentile and goes up to the 95th percentile of the threshold variable instead of the default.

xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) twostep vce(robust) fpctile(5) lpctile(95)

The command xtendothresdpd handles time series operators in any of its variables.

xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr L.lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) twostep vce(robust) fpctile(5) lpctile(95)

We demonstrate the use of the option sig(). We enter the value 0.05 to request the 95 percent confidence
interval for the estimated threshold (the small table of results).

xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) twostep vce(robust) sig(0.05)

We estimate the previous equation with a 99 percent confidence interval for the Dynamic panel-data estimation
(the big table of results).

xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) twostep vce(robust) sig(0.05) level(99)

Now, we exhibit how to employ additional endogenous variables correlated with the error. We
suspect Log Fertility rate to be endogenous.

xtendothresdpd lggdppccstd L.lggdppccstd lggovconsgdpr lgllgdpr, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) xaddendog(lgfertrate)

We have the Log Average Debt over GDP of other countries as an instrument. We specify this instrument in both
the zaddinst() option for the additional instrumental variables for the intermediate computations and the iv()
option for the standard instruments for the difference and level equations.

xtendothresdpd lggdppccstd L.lggdppccstd lggovconsgdpr lgllgdpr, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) xaddendog(lgfertrate) zaddinst(lgdebtothers) iv(lgdebtothers)

In the next regression, we add more lags of the Log Fertility rate in the iv() option. Note that the iv() option,
being an option of the command [XT] xtdpd, can be specified more than once.

xtendothresdpd lggdppccstd L.lggdppccstd lggovconsgdpr, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) xaddendog(lgfertrate) zaddinst(lgdebtothers) iv(lgdebtothers) iv(L(1/2).lgfertrate, nodif)

If we do not want to display the graphic, we type:

xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) twostep vce(robust) nographs

In the following, we demonstrate how to use the saving(string) option. Assume that you have Windows as
your Operating System and you want to save the graphic produced by the command xtendothresdpd in a folder named "mystatagraphs"
located in the "C:\" drive. So the full path name is "C:\mystatagraphs". Note that, you must physically create this folder;
otherwise the next instruction will not work at all. Also if you have an Operating System other than Windows, you must supply
the correct file path according to your Platform. To save the graphic in the "mystatagraphs" folder, just type
(without forgetting the double quotes):

\mystatagraphs")"'

Now, we increase the number grid points used to estimate the threshold to 500.

xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) twostep vce(robust) grid(500)

We demonstrate the use of the fodeviation option in conjunction with the forcereg option.

xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) twostep vce(robust) forcereg fodeviation

We augment the number of lags of the lagged dependent variable to use as instruments for the intermediate computations to 2.

xtendothresdpd lggdppccstd L.lggdppccstd lggovconsgdpr lgllgdpr, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) lagsret(2)

As indicated above, the threshold variable needs not to be same as the variable that depends on the threshold. Here, we specify the threshold variable to
be Liquid liabilities to GDP divided by 100.

xtendothresdpd lggdppccstd L.lggdppccstd lggovconsgdpr lghc, thresv(llgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd)

The command xtendothresdpd can handle more control variables.

xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr lggovconsgdpr lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) twostep vce(robust)

Next, we augment the control variables even more.

xtendothresdpd lggdppccstd L.lggdppccstd lggovconsgdpr lghc lgllgdpr lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd)

In the following, we increase the number of options of the command [XT] xtdpd even more.

xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) lgmmiv(lggdppccstd) div(L(0/3).lgdebtothers, nodifference) vce(robust)

Let us explain how to use the xtendothresdpd command with the [U] if qualifier. We run the
regressions for period > 2.

xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr lginflation if period > 2, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) twostep vce(robust) noconstant

We exhibit how to employ the command xtendothresdpd with the [D] by prefix. First, we
tabulate by the development level of the countries.

tabulate developingcty

Then, we sort the dataset by the development level of the countries.

sort developingcty

Finally, we use the command xtendothresdpd with the [D] by prefix.

by developingcty: xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) twostep vce(robust) noconstant

To continue this Examples section, we now illustrate how to use the command xtendothresdpd with the predict
command. First, we restore the original ordering of the dataset.

tsset

We start by running the following regression.

xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) lgmmiv(lggdppccstd) div(L(0/3).lgdebtothers, nodifference) vce(robust)

We calculate the linear prediction.

predict double xbhat, xb

We calculate the residuals.

predict double residshat, e

We calculate the standard error of the prediction.

predict double stanerphat, stdp

We describe all the previously created variables to see their labels.

describe xbhat residshat stanerphat

We summarize these variables.

summarize xbhat residshat stanerphat

We compute the residuals for the first differences.

predict double residshatde, e difference

We describe the previously created variable to see its label.

describe residshatde

We summarize this variable.

summarize residshatde

To finish this Examples section, we now illustrate how to use the command xtendothresdpd with
the xtendothresdpdtest command. Before beginning, it is important to remind the user that the
command xtendothresdpdtest is a postestimation command. So, you have to run it immediately after executing the
command xtendothresdpd. Also, be sure to save your data before using the command xtendothresdpdtest because
it removes the original dataset in memory. Additionally, remember that the command xtendothresdpdtest is highly
computationally intensive. Hence, I advise you to be very patient when you execute it please. To begin, we first
reload the dataset xtendothresdpddata.dta.

use http://fmwww.bc.edu/repec/bocode/x/xtendothresdpddata.dta, clear

Second, we run the following regression.

xtendothresdpd lggdppccstd L.lggdppccstd lginvestgdpr lginflation, thresv(debtpcgdpr) stub(enr) pivar(debtpcgdpr) dgmmiv(lggdppccstd) twostep vce(robust) grid(100)

Third, we display the returned values of the previous regression.

ereturn list

Fourth, we set the random-number seed for reproducibility purposes.

set seed 542020

Fifth, we test if there is a threshold effect or not in the previous regression with the command xtendothresdpdtest. To
run this test, we begin by indicating the name of command. Then, we specify the option comdline(`e(cmdline)') by supplying the
command line of the previous regression, in left and right single quotes, as was returned by the preceding ereturn list. Finally,
we indicate that we want 50 replications for our bootstrap.

`"xtendothresdpdtest, comdline(`e(cmdline)') reps(50)"'

In the table of results of the command xtendothresdpdtest, the statistic SupWStar allows to test for H0 in
expression (5). The Null Hypothesis for this test, is that there is no threshold effect in equation (1) and
the Alternative Hypothesis is that there is a threshold effect in equation (1). Since the statistic SupWStar is
statistically significant at the 5 percent level, we conclude that there is a threshold effect in the previous regression.

To see the returned values of the command xtendothresdpdtest, we type:

ereturn list

To see the Observed Coefficient of the SupWStar statistic, we type:

matrix list e(b)

References

Caner Mehmet and Hansen Bruce E.: 2004, "Instrumental Variable Estimation of a Threshold Model", Econometric Theory 20(5), 813-843.

Davies Robert B.: 1977, "Hypothesis Testing when a Nuisance Parameter is Present only under the Alternative", Biometrika 64, 247-254.

Hansen Bruce E.: 1999, "Threshold Effects in Non-Dynamic Panels: Estimation, Testing, and Inference", Journal of Econometrics 93, 345-368.

Kremer Stephanie, Bick Alexander and Nautz Dieter: 2013, "Inflation and Growth: New Evidence from a Dynamic Panel Threshold Analysis", Empirical Economics 44, 861-878.

Acknowledgements

I thank Stephanie Kremer, Alexander Bick and Dieter Nautz; Bruce E. Hansen; Mehmet Caner; Robert B. Davies; and Sebastian Kripfganz for writing
and making their programs and articles publically available. This current Stata package is based and inspired by their
works. The usual disclaimers apply: all errors and imperfections in this package are mine and all comments are very welcome.

Author

Diallo Ibrahima Amadou

CERDI, University of Clermont Auvergne

26 Avenue Leon Blum

63000 Clermont-Ferrand

France

E-Mail: zavren@gmail.com

Also see

Online: help for [XT] xtdpd, xthreg (if installed), xthenreg (if installed), tstransform (if installed), suchowtest (if installed), tslstarmod (if installed)