门限回归Stata操作汇总与空间门槛回归模型简介
来源 | 数量经济学综合整理
转载请联系
进⾏回归分析,⼀般需要研究系数的估计值是否稳定。很多经济变量都存在结构突变问题,使⽤普通回归的做法就是确定结构突变点,进⾏分段回归。这就像我们⾼中学习的分段函数。但是对于⼤样本、⾯板数据如何寻结构突变点。所以本⽂在此讲解⾯板门限回归的问题,门限回归也适⽤于时间序列(⽂章后⾯将介绍stata15.0新命令进⾏时间序列的门限回归)。
门限效应,是指当⼀个经济参数达到特定的数值后,引起另外⼀个经济参数发⽣突然转向其它发展形式的现象(结构突变)。作为原因现象的临界值称为门限值。例如,成果和时间存在⾮线性关系,但是在每个阶段是线性关系。有些⼈将这样的模型称为门槛模型,或者门限模型。如果模型的研究对象包含多个个体多个年度,那么就是门限⾯板模型。
⼀、history&Hansen
常见模型如下:门槛回归模型(threshold regression,也称门限回归):
汉森(Bruce E. Hansen)在门限回归模型上做出了很多贡献。Hansen于1996年在《Econometrica》上发表⽂章《Inference when a nuisance parameter is not identified under the null hypothesis》,提出了时间序列门限⾃回归模型(TAR)的估计和检验。之后,他在门限模型上连续追踪,发表了⼏篇经典⽂章,尤其是1999年的《Threshold effects in non-dynamic panels: Estimation, testing and inference》(Hansen (1999) ⾸次介绍了具有个体效应的⾯板门限模型的计量分析⽅法, 该⽅法以残差平⽅和最⼩化为条件确定门限值, 并检验门限值的显著性, 克服了主观设定结构突变点的偏误。具体思路是:选定某⼀变量作为门限变量, 根据搜寻到的门限值将回归模型区分为多个区间, 每个区间的回归⽅程表达不同, 根据门限划分的区间将其他样本值进⾏归类, 回归后⽐较不同区间系数的变化。),2000年的《Sample splitting and threshold estimation》和2004年与他⼈合作的《Instrumental Variable Estimation of a Threshold Model》。
在这些⽂章中,Hansen介绍了包含个体固定效应的静态平衡⾯板数据门限回归模型,阐述了计量分析⽅法。⽅法⽅⾯,⾸先要通过减去时间均值⽅程,消除个体固定效应,然后再利⽤OLS(最⼩⼆乘法)进⾏系数估计。如果样本数量有限,那么可以使⽤⾃举法(Bootstrap)重复抽取样本,提⾼门限效应的显著性检验效率。在Hansen(1999)的模型中,解释变量中不能包含内⽣解释变量,⽆法扩展应⽤领域。Caner和Hansen在2004年解决了这个问题。他们研究了带有内⽣变量和⼀个外⽣门限变量的⾯板门限模型。与静态⾯板数据门限回归模型有所不同,在含有内⽣解释变量的⾯板数据门限回归模型中,需要利⽤简化型对内⽣变量进⾏⼀定的处理,然后⽤2SLS(两阶段最⼩⼆乘法)或者
GMM(⼴义矩估计)对参数进⾏估计。
⼆.显著性检验
门槛回归模型显著性检验的⽬的是,检验以门檻值划分的两组样本其模型估计参数是否显著不同。
因此,不存在门槛值的零假设为:Ho:两个系数相同。同时构造LM统计量:
其中,So是在零假设下的残差平⽅和。由于LM统计量并不服从标准的分布。因此, Hansen(2000)提出了通过“⾃举法”( Bootstrap)来获得渐进分布的想法,进⽽得出相应的概率p值,也称为 Bootstrap P值。
这种⽅法的基本思想是:在解释变量和门槛值给定的前提下,模拟( Simulate)产⽣⼀组因变量序列,并使其满⾜
N(0,e2),其中e是式(4)的残差项。每得到⼀个⾃抽样样本,就可以计算出⼀个模拟的エM统计量。将这⼀过程重复1000次。Hansen(1996)认为模拟产⽣的LM统计量⼤于式(6)的次数占总模拟次数的百分⽐就是“⾃举法”估计得到的P值。这⾥的Bootstrap P值类似于普通计量⽅法得出的相伴概率P值。例如,当 Bootstrap P值⼩于0.01时,表⽰在1 %的显著性⽔平下通过了LM检验,以此类推。
三.置信区间
以上的检验过程为只有⼀个门槛值的检验过程,为了能确定是否存在两个门槛值或者是更多的门槛值,我们应当检验是否存在两个门槛值,拒绝意味着⾄少存在⼀个门槛值。我们可以假设⼰经估计的第⼀个门槛值,然后开始寻第⼆个门槛值。在确定有两个门槛值后,再寻第三个门槛值,⽅法都和前⾯的⼀样,直⾄我们不能拒绝零假设。
四、门槛回归:threshold
阈值将⼀个状态从另⼀个状态描述出来。有⼀个效应(⼀组系数)达到阈值和另⼀个效应(另⼀组系数)。Stata的新门限命令适⽤于时间序列。门槛模型常⽤于时间序列数据。门槛可以是⼀个时间。例如,如果你认为投资策略在某个未知的⽇期发⽣了变化,你可以⽤⼀个模型来获得⽇期的估计,并在它前后得到不同系数的估计。或者门槛值可以⽤另⼀个变量来表⽰。例如,在⼀定程度的通货膨胀之外,央⾏会提⾼利率。你可以⽤⼀个模型来得到门槛值的估计值和两边的系数。
在Stata 15中,进⾏门槛回归的命令为 threshold,语法格式为:threshold depvar [indepvars] [if] [in],
threshvar(varname) [options]
其中,其中, depvar为被解释变量, indepvars为相关变量(解释变量)。必选项 threshvar( varname) 表⽰变量varname为门槛变量,选项 nthresholds(#)指的是number of thresholds,这个命令
默认只有⼀个门槛值( default is nthresholds(1))。也可以通过选择项 nthresholds(#) 来指定多个门槛值,⽐如 nthresholds(2) 表⽰有 2 个门槛值,not allowed with optthresh。
optthresh(#[, ictype]), select optimal number of thresholds less than or equal to #; not allowed with nthresholds,计算最优的门槛个数,⼀般有Bayesian information criterion (BIC)、Akaike information criterion (AIC) 、Hannan-Quinn information criterion (HQIC)三个信息准则。其中默认使⽤BIC信息准则进⾏选择。
菜单操作步骤为:Statistics > Time series > Threshold regression model
门槛回归Example
调⽤数据:
webuse usmacro
下⾯进⾏门限回归
threshold fedfunds, regionvars(l.fedfunds inflation ogap) ap)
threshold fedfunds, regionvars(l.fedfunds inflation ogap) ap) optthresh(5)
▲图:结果输出
五、xthreg命令
xthreg需要stata13及以上版本
语法格式为:
bootstrap检验方法xthreg depvar [indepvars] [if] [in], rx(varlist) qx(varname) [thnum(#) grid(#) trim(numlist) bs(numlist) thlevel(#)
xthreg depvar [indepvars] [if] [in], rx(varlist) qx(varname) [thnum(#) grid(#) trim(numlist) bs(numlist) thlevel(#)
gen(newvarname) noreg nobslog thgiven options]
depvar被解释变量,indepvars 解释变量,qx(varname) is the threshold variable,门限变量,thnum(#) is the number of thresholds,在stata13.0中门槛值是必要项⽬,需要等于⼤于1,⼩于等于3,默认值为1,也就是⾄少存在三个门槛值。
rx(varlist) is the regime-dependent variable. Time-series operators are allowed. rx is required. 区制变量或者制度变量qx(varname) is the threshold variable. Time-series operators are allowed. qx is required. 门限变量或者门槛变量thnum(#) is the number of thresholds. In the current version (Stata 13), # must be equal to or less than 3. The default is thnum(1). 门槛个数
grid(#) is the number of grid points. grid is used to avoid consuming too much time when computing large samples. The default is grid(300). ⽹格点数
trim(numlist) is the trimming proportion to estimate each threshold. The number of trimming proportions must be equal to the number of thresholds specified in thnum. The default is trim(0.01) for all thresholds. For example, to fit a triple-threshold model, you may set trim(0.01 0.01 0.05).
bs(numlist) is the number of bootstrap replications. If bs is not set, xthreg does not use bootstrap for the threshold-effect test. bootstrap迭代次数
thlevel(#) specifies the confidence level, as a percentage, for confidence intervals of the threshold. The default is thlevel(95). 置信区间,默认为95%,即thlevel(95)
gen(newvarname) generates a new categorical variable with 0, 1, 2, ... for each regime. The default is gen(_cat). noreg suppresses the display of the regression result. 不显⽰回归结果
nobslog suppresses the iteration process of the bootstrap. 不显⽰bootstrap迭代过程
thgiven fits the model based on previous results. options are any options available for [XT] xtreg.
Time-series operators are allowed in depvar, indepvars, rx, and qx.
门槛回归的案例
use hansen1999
Estimate a single-threshold model
xthreg i q1 q2 q3 d1 qd1, rx(c1) qx(d1) thnum(1) trim(0.01) grid(400) bs(300)
输出结果包括四个部分。第⼀部分输出门限估计值和⾃举法的结果。第⼆部分列表输出门限值及置信区间,Th-1代表单⼀门限估计值,Th-21 和Th-22代表双门限回归的两个估计值,有时Th-21和Th-1相同。第三部分列出了门限检验,包括RSS、MSE、F统计量及概率值,以及10%、5%、1%的置信⽔平。第四部分是固定效应回归结果。
六、xtthres命令
语法格式为:xtthres varlist [if] [in] , thres(varname) dthres(varname) [ qn(#) bs1(#) bs2(#) bs3(#) levle(#) minobs(#) ] thres(varname) specifies threshold variable, as denoted by q_it in Hansen(1999). Note that this option should not be omitted.
dthres(varname) specifies the variable that will show threshold effects, as denoted by x_it in Hansen(1999). This variable will be multipled by the indicator function I(.). Note that this option should not be omitted either.
qn(#) specifies the number of distinct values to be search in finding out the optimal estimate of threshold effects, r_hat, which will minimize the sum of square residuals of the model. The default value is 400.
bs1(#), bs2(#), bs3(#) specify the Bootstrap times in single threshold, double threshold and triple threshold model respectively. The default values are all 300.
level(#) specifies the confidence level, in percent, for confidence intervals. The default is level(95) or as set by set level; see help level.
minobs specifies the minimum number of observations in each of the regimes when searching for r_hats. The default is 10.
案例介绍1
xtthres tobin size tang prof, th(grow) d(tl)
xtthres tobin size tang prof, th(grow) d(tl) bs2(200) bs3(100) minobs(30)
xtthres tobin size tang prof if year<=2001, th(grow) d(tl) qn(200)
案例介绍2
cd E:stataresults //设置⼯作路径,保存输出结果
use E:statapersonal18datahansen1999, clear // 调⼊ Hansen99 数据
*-Table 1: Summary statistics
tabstat i q1 c1 d1, s(min p25 p50 p75 max) format(%6.3f) c(s)
Estimating
xtthres i q1 q2 q3 d1 qd1, th(d1) d(c1) min(120) bs1(300) bs2(300) bs3(200)
七、空间⾯板门槛模型简介
⼋、参考⽂献及资源下载
计量经济分析⽅法与建模:EViews应⽤及实例
Hansen, B. E. 1999. Threshold effects in non-dynamic panels: Estimation, testing, and inference. Journal of Econometrics 93: 345-368.
Wang, Qunyong, 2015. "Fixed-effect Panel Threshold Model Using Stata," The Stata Journal, 15(1), 121-134.连⽟君,程建. 不同成长机会下资本结构与经营绩效之关系研究. 当代经济科学,2006(2):97-103.
资源下载