门槛回归基本要求(Hansen,1999)rx(varlist)istheregime-dependentvariable.Time-seriesoperatorsareallowed.(时间序列数据被允许操作)rx()isrequired.(格式要求)qx(varname)isthethresholdvariable(门槛变量).Time-seriesoperatorsareallowed.qx()isrequired.If.如果门槛变量就是核心(主要)解释变量,fdi既是门槛变量又是解释变量,命令中要写成rx(fdi)和qx(fdi)Ifnot.xthregyx1x3,rx(x2)qx(x3)thnum(1)trim(0.05)grid(400)bs(1000),这样x3是门槛变量.应该是x2对y之效果受到x3是否大于或小于某一个门槛值之影响thnum(#)isthenumberofthresholds.(门槛值数量)Inthecurrentversion(Stata13),#mustbeequaltoorlessthan3.Thedefaultisthnum(1).门槛值数量,在当前的Stata13版本中,数值选取不能大于3,默认值是1grid(#)isthenumberofgridpoints.大样本情况下采用格点法,一般不用关注。选用默认值即可。grid()isusedtoavoidconsumingtoomuchtimewhencomputinglargesamples.Thedefaultisgrid(300).trim(numlist)isthetrimmingproportion(修正比例)toestimateeachthreshold.Thenumberoftrimmingproportionsmustbeequaltothenumberofthresholdsspecifiedinthnum().Thedefaultistrim(0.01)forallthresholds.Forexample,tofitatriple-thresholdmodel,youmaysettrim(0.010.010.05).修正比例的数量必须和门槛值数量相同。bs(numlist)isthenumberofbootstrapreplications.Ifbs()isnotset,xthregdoesnotusebootstrapforthethreshold-effecttest.Thenumberofbootstrapreplicationsmustbeequaltothenumberofthresholdsspecifiedinthnum().Eg:xthregyx1x3,rx(x2)qx(x3)thnum(2)trim(0.050.05)grid(400)bs(10001000)thlevel(#)specifiestheconfidencelevel,asapercentage,forconfidenceintervalsofthethreshold.Thedefaultisthlevel(95).gen(newvarname)generatesanewcategoricalvariablewith0,1,2,...foreachregime.Thedefaultisgen(_cat).noregsuppressesthedisplayoftheregressionresult.nobslogsuppressestheiterationprocessofthebootstrap.thgivenfitsthemodelbasedonpreviousresults.Eg:如果研究经济增长(x3)对二氧化碳排放(y)是否存在门槛效应,门槛变量和解释变量都设为经济增长:xthregyx1x2,rx(x3)qx(x3)thnum(1)trim(0.05)grid(400)bs(1000)其中,x1,x2为其他解释变量,那么结果就可以解释当经济增长超过门槛值时,其对二氧化碳排放的作用是多少,当经济增长低于门槛值时,其对经济增长的作用是多少。如果以经济增长为门槛研究能源消费结构(x2)对二氧化碳排放(y)的影响,xthregyx1x3,rx(x2)qx(x3)thnum(1)trim(0.05)grid(400)bs(1000)使用finditxthreg命令代码安装