*! version 1.0.1 // A METTRE
help tslstarmod

Title

Performs an Estimation of a Logistic Smooth Transition Autoregressive Regression (LSTAR) Model for Time Series Data

Syntax

tslstarmod
depvar
indepvars
[if] [in]
[, options]

Model
thresv(varname) indicates the threshold variable

constraints(estimation options##constraints():constraints) apply specified linear constraints

exposure(varname:varname_e) include ln(varname_e) in model with coefficient constrained to 1

offset(varname:varname_o) include varname_o in model with coefficient constrained to 1

noconstant suppress constant term

nolrtest report the model Wald test

init specify the computation of the internal initial values

Reporting
level(#) set confidence level; default is level(95)

eform report exponentiated coefficients

SE/Robust
vce(vcetype) vcetype may be oim, robust, or opg

cluster(varname) adjust standard errors for intragroup correlation; implies vce(robust)

Max options
maximize_options control the maximization process; seldom used

You must tsset your data before using tslstarmod; see tsset.

depvar, indepvars and thresv(varname) may contain time-series operators; see tsvarlist.

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

Description

tslstarmod performs an estimation of a logistic smooth transition autoregressive regression (LSTAR) model
for time series data. This command allows estimating an endogenous structural break point in a time series
data. The endogenous threshold when found is determined smoothly, contrarily to brutal transitions. In
this regard, the LSTAR model can be considered as a generalization of the usual autoregressive
process because the transition function is a smooth logistic function. The command allows to
test the presence of an LSTAR model against a presence of a linear autoregressive model. It
also handles the determination of the delay parameter. The theory behind the command tslstarmod
can be found, for instance, in Terasvirta (2004) and Enders (2015).

Econometric Model

The estimated econometric model can be written as:

y_t = alpha_0 + alpha_1*y_ + ... + alpha_p*y_ + theta*[beta_0 + beta_1*y_ + ... + beta_p*y_] + epsilon_t (1)

where

t = 1,...,T is the time;

y_t in equation (1), are the time series of interest;

alpha_i, i = 1,...,p are autoregressive coefficients in the first regime;

beta_i, i = 1,...,p are autoregressive coefficients in the second regime;

p specifies the order of the autoregressive process;

epsilon_t is the error term;

theta = [1 + exp(-gamma*(y_ - cpar))]^(-1) (2);

theta in equation (2), is the first order logistic function which varies between 0 and 1;

The functional form and the boundedness of theta make that the estimation becomes a smooth transition between the two
regimes dynamically rather than a brutal jump from one regime to the other as the value of y_ changes;

gamma indicates the smoothness parameter;

y_ specifies the threshold or transition variable;

d represents the delay parameter;

cpar designates the threshold parameter;

Options

Model

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

constraints(estimation options##constraints():constraints),
exposure(varname:varname_e),
offset(varname:varname_o), and
noconstant;
see estimation options.

nolrtest indicates that the model significance test should be a Wald
test instead of a likelihood-ratio test.

init specifies the computation of the internal initial values. If you want
to calculate the initial values, you indicate this, by issuing the option init. Then
the command internally computes these initial values for you.

Reporting

level(#); set confidence level; default is level(95).

eform specifies that the coefficient table be
displayed in exponentiated form.

SE/Robust

vce(vcetype); vcetype may be oim, observed information matrix (OIM);
robust, Huber/White/sandwich estimator; or opg, outer product of the gradient
(OPG) vectors. see vce_option for more details.

cluster(varname); adjust standard errors for intragroup correlation; implies vce(robust).

Max options

maximize_options:
difficult,
technique(algorithm_spec),
iterate(#),
[no]log,
trace,
gradient,
showstep,
hessian,
showtolerance,
tolerance(#),
ltolerance(#),
nrtolerance(#),
nonrtolerance;
see [R] maximize.
These options are seldom used.

Syntax for predict

The syntax for predict after the command tslstarmod is:

predict [type] newvar [if] [in] [, Options_for_predict]

Options for predict

xb, the default, calculates the prediction from all the equations taken together in equation (1) above. It
computes: alpha_0_hat + alpha_1_hat*y_ + ... + alpha_p_hat*y_ + theta_hat*[beta_0_hat + beta_1_hat*y_ + ... + beta_p_hat*y_].

lngamma, calculates the prediction of ln(gamma) in equation (2) above. It computes: ln(gamma_hat).

cpar, calculates the prediction of cpar in equation (2) above. It computes: cpar_hat.

lnsigma, calculates the prediction of ln(sigma) where sigma is the standard error of the regression. It computes: ln(sigma_hat).

gamma, calculates the prediction of gamma in equation (2) above. It computes: gamma_hat.

sigma, calculates the prediction of sigma where sigma is the standard error of the regression. It computes: sigma_hat.

stdp calculates the standard error of the prediction.

regime1, calculates the prediction from the Regime1 equation only in equation (1) above. It computes: alpha_0_hat + alpha_1_hat*y_ + ... + alpha_p_hat*y_.

regime2, calculates the prediction from the Regime2 equation only in equation (1) above. It computes: beta_0_hat + beta_1_hat*y_ + ... + beta_p_hat*y_.

residuals, calculates the residuals from all the equations taken together in equation (1) above. It
computes: epsilon_t_hat = y_t - (alpha_0_hat + alpha_1_hat*y_ + ... + alpha_p_hat*y_ + theta_hat*[beta_0_hat + beta_1_hat*y_ + ... + beta_p_hat*y_]).

theta, calculates the prediction of theta in equation (2) above. It computes: theta_hat.

Syntax for tslstarmodtest

This command allows to test for the presence of an LSTAR model against a presence of a linear autoregressive model. It also
handles the determination of the delay parameter.

tslstarmodtest
depvar
indepvars
[if] [in]
, options_for_tslstarmodtest

Options for tslstarmodtest

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

maxlags(integer) represents the maximum number of lags you indicated for the independent variables. To form
this option, you put inside the brackets, the maximum number of lags you indicated for the independent
variables, indepvars, you specified for this command. That is, if you specified the command
as: tslstarmodtest D.wpi L(1/3)D.wpi, thresv(LD.wpi), you must choose 3 for the maxlags(integer) option
to get a final result of: tslstarmodtest D.wpi L(1/3)D.wpi, thresv(LD.wpi) maxlags(3). This, because you
chose 3 lags of the first difference of the variable wpi as your independent variables. You must specify
this option in order to get a result. Hence this option is required.

Return values for tslstarmod

tslstarmod saves the following in e(). Note that these saved results are almost the same as those
returned by the command [R] maximize since tslstarmod is fitted using [R] ml:

Scalars

e(N) number of observations; always saved

e(k) number of parameters; always saved

e(k_eq) number of equations; usually saved

e(k_eq_model) number of equations to include in a model Wald
test; usually saved

e(k_dv) number of dependent variables; usually saved

e(k_autoCns) number of base, empty, and omitted constraints; saved if command supports constra
> ints

e(df_m) model degrees of freedom; always saved

e(r2_p) pseudo-R-squared; sometimes saved

e(ll) log likelihood; always saved

e(ll_0) log likelihood, constant-only model; saved when
constant-only model is fit

e(N_clust) number of clusters; saved when vce(cluster
clustvar) is specified;
see

e(chi2) chi-squared; usually saved

e(p) significance of model of test; usually saved

e(rank) rank of e(V); always saved

e(rank0) rank of e(V) for constant-only model; saved
when constant-only model is fit

e(ic) number of iterations; usually saved

e(rc) return code; usually saved

e(converged) 1 if converged, 0 otherwise; usually saved

e(k_aux) number of ancillary parameters; always saved

Macros

e(cmd) name of command; always saved

e(cmdline) command as typed; always saved

e(depvar) names of dependent variables; always saved

e(wtype) weight type; saved when weights are specified or
implied

e(wexp) weight expression; saved when weights are specified or
implied

e(title) title in estimation output; usually saved by commands using ml

e(clustvar) name of cluster variable; saved when
vce(cluster clustvar) is specified;
see

e(chi2type) Wald or LR; type of model chi-squared
test; usually saved

e(vce) vcetype specified in vce(); saved when command
allows vce()

e(vcetype) title used to label Std. Err.; sometimes saved

e(opt) type of optimization; always saved

e(which) max or min; whether optimizer is to perform
maximization or minimization; always saved

e(ml_method) type of ml method; always saved by commands
using ml

e(user) name of likelihood-evaluator program; always saved

e(technique) from technique() option; sometimes saved

e(singularHmethod) m-marquardt or hybrid; method used
when Hessian is singular; sometimes saved

e(crittype) optimization criterion; always saved

e(properties) estimator properties; always saved

e(predict) program used to implement predict; usually
saved

e(thresva) threshold variable; always saved

Matrices

e(b) coefficient vector; always saved

e(Cns) constraints matrix; sometimes saved

e(ilog) iteration log (up to 20 iterations); usually saved

e(gradient) gradient vector; usually saved

e(V) variance-covariance matrix of the estimators; always
saved

e(V_modelbased) model-based variance; only saved when e(V)
is neither the OIM nor OPG variance

Functions

e(sample) marks estimation sample; always saved

Return values for tslstarmodtest

tslstarmodtest saves the following in r():

Scalars
r(df) degrees of freedom
r(chi2_p) p-value of the chi-squared statistic
r(chi2) Chi-squared statistic

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 tslstarmod with the Stata manual dataset wpi1.

use http://www.stata-press.com/data/r15/wpi1, clear

We regress the dependent variable (D.wpi; here the first difference of wpi) on the regressors (LD.wpi;
here the lagged value of the first difference of wpi). We specify the threshold variable (LD.wpi) in the
required option thresv().

tslstarmod D.wpi LD.wpi, thresv(LD.wpi)

Having done that, let us now turn to the explanation of the output of the previous estimation. The table of results
is divided into four parts: the first part shows the word Regime1 which specifies the coefficients for the first
regime. They represent the alpha_i in equation (1). Since we have one regressor (LD.wpi), we get two coefficients
in this part of the table if we take the constant term into account. The second part displays the word Regime2 which
indicates the coefficients for the second regime. They indicate the beta_i in equation (1). Since we have one
regressor (LD.wpi), we get two coefficients in this part of the table if we take the constant term into account. The third
part displays the parameters /lngamma, /cpar and /lnsigma. They designate the parameters
ln(gamma_hat), cpar_hat and ln(sigma_hat) respectively as indicated in equation (2) and explained in the
section Options for predict. The fourth part displays the parameters gamma and sigma. They specify the
parameters gamma_hat and sigma_hat respectively as indicated in equation (2) and explained in the section
Options for predict.

We illustrate the use of the technique() option by putting inside the brackets the name dfp, which stands
for the Davidon-Fletcher-Powell (DFP) algorithm.

tslstarmod D.wpi LD.wpi, thresv(LD.wpi) technique(dfp)

In the next regression, we demonstrate how to compute the robust or sandwich estimator of variance.

tslstarmod D.wpi LD.wpi, thresv(LD.wpi) vce(robust)

We augment the number of regressors to two, and in addition to the technique(dfp) option, we specify
the difficult option and set the tolerances to 0.05, because the likelihood function becomes harder to maximize.

tslstarmod D.wpi LD.wpi L2D.wpi, thresv(LD.wpi) technique(dfp) difficult tolerance(0.05) ltolerance(0.05) nrtolerance(0.05) vce(robust)

Now, we increase the number of regressors to three.

tslstarmod D.wpi LD.wpi L2D.wpi L3D.wpi, thresv(LD.wpi) technique(dfp) difficult tolerance(0.05) ltolerance(0.05) nrtolerance(0.05) vce(robust)

If we do not want to display the iterations log at the beginning of the regression, we type.

tslstarmod D.wpi LD.wpi, thresv(LD.wpi) vce(robust) nolog

If we want to specify the computation of the internal initial values, we type.

tslstarmod D.wpi LD.wpi, thresv(LD.wpi) vce(robust) init

Note that specifying the init option, could in some cases, help us
to maximize the likelihood function quickly when we are having convergence problems.

We now illustrate how to use the command tslstarmod with predict.

We calculate the prediction of ln(gamma).

predict double lngammapred, lngamma

We calculate the prediction of cpar.

predict double cparpred, cpar

We calculate the prediction of ln(sigma).

predict double lnsigmapred, lnsigma

We calculate the prediction of gamma.

predict double gammapred, gamma

We calculate the prediction of sigma.

predict double sigmapred, sigma

We calculate the prediction from the Regime1 equation only.

predict double regime1pred, regime1

We calculate the prediction from the Regime2 equation only.

predict double regime2pred, regime2

We calculate the prediction from all the equations taken together.

predict double xballpred, xb

We calculate the residuals from all the equations taken together.

predict double residualspred, residuals

We calculate the prediction of theta.

predict double thetapred, theta

We calculate the standard error of the prediction.

predict double stdppred, stdp

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

describe lngammapred cparpred lnsigmapred gammapred sigmapred regime1pred regime2pred xballpred residualspred thetapred stdppred

We summarize these variables.

summarize lngammapred cparpred lnsigmapred gammapred sigmapred regime1pred regime2pred xballpred residualspred thetapred stdppred

Now, we perform the test for the presence of an LSTAR model. Suppose that we have found that the best lag order for
our autoregressive process is p = 2. Hence, in our case here, we form our test by choosing 2 lags of the first
difference of the variable wpi as our independent variables (L(1/2)D.wpi). We specify the first lag of the
first difference of wpi as our threshold variable (thresv(LD.wpi)). We indicate 2 for the maxlags() option
because you chose 2 lags of the first difference of the variable wpi as our independent variables. Thus, we
specify maxlags(2) to obtain a final result of:

tslstarmodtest D.wpi L(1/2)D.wpi, thresv(LD.wpi) maxlags(2)

The p-value of the Lagrange Multiplier Test result illustrates that we reject the null hypothesis of the Presence
of Linearity at the 5% statistical significance level. Hence, there is a Presence of an LSTAR Model.

Next, we run the same test with L2D.wpi as our threshold variable.

tslstarmodtest D.wpi L(1/2)D.wpi, thresv(L2D.wpi) maxlags(2)

We see that we cannot reject the null hypothesis of the Presence of Linearity for this test.

We run the same test with L3D.wpi as our threshold variable.

tslstarmodtest D.wpi L(1/2)D.wpi, thresv(L3D.wpi) maxlags(2)

Here also, we see that we cannot reject the null hypothesis of the Presence of Linearity for this test.

From these last three tests, we find that the delay parameter d = 1 and that we have a Presence of an LSTAR
Model. Hence, the best test is the following: tslstarmodtest D.wpi L(1/2)D.wpi, thresv(LD.wpi) maxlags(2). This, because
this test gives the smallest and most significant p-value for the test. This p-value also provides the greatest power
for the test. We reproduce this best test next for convenience.

tslstarmodtest D.wpi L(1/2)D.wpi, thresv(LD.wpi) maxlags(2)

References

Enders, Walter: 2015, Applied Econometric Time Series, Fourth Edition, Wiley, Wiley Series in Probability and Statistics.

Terasvirta, Timo: 2004, Smooth Transition Regression Modeling, in Applied Time Series Econometrics, edited by
Lutkepohl, Helmut and Kratzig, Markus, pp. 222-242, Cambridge University Press, Themes in Modern Econometrics.

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 [TS] arima, [TS] mswitch, [R] ml, [R] maximize