楼主: xuelida
6040 13

[学科前沿] gauss 编程应用于学科前沿二:非线性单位根 [推广有奖]

  • 1关注
  • 94粉丝

教师

计量经济学

学科带头人

50%

还不是VIP/贵宾

-

威望
1
论坛币
58808 个
通用积分
27.8128
学术水平
394 点
热心指数
256 点
信用等级
169 点
经验
47973 点
帖子
1506
精华
7
在线时间
1066 小时
注册时间
2005-12-5
最后登录
2024-2-14

楼主
xuelida 在职认证  发表于 2013-7-10 18:04:08 |只看作者 |坛友微信交流群|倒序 |AI写论文
相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
这是上一个完成的帖子之后,第二个关于gauss 编程应用于学科前沿二:非线性单位根

三个方面的内容:
结构突变的单位根
阈值单位根
马尔科夫转制单位根

各位坛友不用着急,程序以及说明太多,还有一些文章需要上传,所以这个过程会很慢的。

我要说明的是,有些程序在网上很容易找到,这个我就不进行详细说明。
有些是我通过其他途径很不容易找到,这部分我会详细说明的,可能需要付一些费用,敬请大家原谅。


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:GAUSS 学科前沿 非线性 USS Aus 文章 程序 网上

已有 3 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
xuehe + 100 + 100 + 4 + 3 + 2 根据规定进行奖励
zhaomn200145 + 5 + 5 + 5 奖励积极上传好的资料
liujianfang + 100 奖励积极上传好的资料

总评分: 经验 + 200  论坛币 + 100  学术水平 + 9  热心指数 + 8  信用等级 + 7   查看全部评分

本帖被以下文库推荐

沙发
xuelida 在职认证  发表于 2013-7-10 18:13:46 |只看作者 |坛友微信交流群
结构突变的单位根:
大家可以先看Junsoo Lee教授的程序,基本上说明了几个最出名的例子:包括已知突变点的单位根检验和未知(内生)突变点的单位根检验,含一个或多个突变点。相关程序读者可以到他的主页上下载,这里就不多说了。
1、Tests with Structural Breaks With Given Break Points
Perron's (augmented type) Test (Econometrica, 1989) (perron.txt)
Amsler and Lee's LM (augmented type) Test (Econometric Theory, 1995) (AL.txt)
Stationarity Test with Multiple Breaks (Editor's book, Lee) (stat.txt)
2、With Data-dependent Break Points
Zivot and Andrews Test (One break) (JBES, 1992) (ZA.txt)
Lumsdaine and Papell Test (Two breaks) (Restat, 1997) (LPtwo.txt)
Lee and Strazicich LM Test (One break) (ls.txt)
Lee and Strazicich LM Test (Two breaks, Restat, 2003) (LStwo.txt)

使用道具

藤椅
xuelida 在职认证  发表于 2013-7-10 18:37:58 |只看作者 |坛友微信交流群
先把几篇结构突变的单位根检验论文帖上来,供大家阅读。

2.Banerjee, A., Lumsdaine R. L. and J. H. Stock (1992)“Recursive and sequential tests of the unit-root and trend break hypotheses:theory and international evidence”, Journal of Business and EconomicStatistics, 10, 271-287

Banerjee, Lumsdaine and Stock(1992) use various recursive and sequential tests which endogenise thebreakpoint. They consider the recursive maximum and minimum DF test and thedifference between them deriving the asymptotic distribution of the recursiveand sequential test statistics and tabulating the relative critical values.

3.Perron, P. (1989)“The great crash, the oil-price shock and the unit root hypothesis”, Econometrica,57, 1361-1401

Perron (1989) first showed theimportance of such tests, arguing that if there is a break in the deterministictrend, unit root tests tend to under-reject the null of a unit root. Taking thebreakpoint as exogenous, he suggests a modification of the Dickey-Fuller testwith three different types of deterministic trend functions. These allow, inturn, for a one-off change in the intercept, a change in slope of the trend,and both of them. The null of a unit root is then tested against thealternative of a broken trend stationary. After Perron’s (1989) seminal paperseveral testing methods have been developed where the break point is assumed tobe unknown. This is often referred to as an endogenous breakpoint. Theseprocedures comprise recursive (using sub-samples), rolling (using a fixed-sizewindow that moves along the sample), and sequential methods (includingswitching dummies in the full sample).

4.Zivot , E. and D.W.K. Andrews (1992) “Further evidence onthe great crash, the oil-price shock and he unit root hypothesis”, Journalof Business and Economic Statistics, 10, 251-270

Zivot and Andrews (1992) use asequential unit root test, derive its distribution, and tabulate its criticalvalues.

5.Lumsdaine R. L. and D. H. Papell (1997) “Multiple trendbreaks and the unit root hypothesis”, Review of Economics and Statistics,79, 212-218

Lumsdaine and Papell (1997)extend the analysis to the case of multiple breaks with unknown breakpoints.

6.Gregory, A. W., Nason, J. M. and D. Watt (1996) “Testingfor structural breaks in cointegrated relationships”, Journal ofEconometrics, 71, 324-341

Gregory, Nason and Watt (1996)study the sensitivity of the ADF test for cointegration in the presence of asingle permanent break. Using Monte Carlomethods they show that the presence of a break results in under-rejection ofthe null of no cointegration implying the inappropriateness of constantparameter cointegration analysis in such cases.

7.Hansen B. E., (1992) “Tests for parameter instability inregressions with I(1) processes”, Journal of Business and EconomicStatistics, 10, 321-335

Hansen (1992) derives theasymptotic distribution of a LM test for parameter instability against severalalternatives in the context of cointegrated regression models.

8.Gregory, A. and B. E. Hansen, (1996) “Residual –basedtests for cointegration in models with regime shifts”, Journal ofEconometrics, 70, 99-126

Gregory and Hansen (1996) proposeseveral tests for the null of no cointegration against the alternative ofcointegration in the presence of a possible break in the intercept or the slopecoefficients in the cointegrating relation at an unknown point in time.

9.Seo, B. (1998)“Tests for structural change in cointegrated systems” Econometric Theory,14, 222-259

Seo (1998) defines LM tests statistics for structuralchanges in both the cointegrating vector and the vector of adjustmentparameters for both the cases of a known and unknown breakpoint. Using Monte Carlo methods he finds that the tests forstructural change of the cointegrating vector have a non-standard distributionthat is equal to the one found by Hansen (1992) using the FM technique.

10.VOGELSANG, T. J. (1997) Wald-typetests for detecting breaks in the trend function of a dynamic time series,Econometric Theory, 13: 818-849.

11.PERRON, P., T. J. VOGELSANG. (1993)Testing for a Unit Root in a Time Series with a Shift in Mean: Corrections andExtensions. Journal of Business and Economic Statistics, 10: 467-470.

12.PERRON, P., T. J. VOGELSANG. (1998)Additional Tests for Unit Root Allowing the Possibilityof Breaks in the TrendFunction. International Economic Review, 39: 1073-110.

We consider unit root tests that allowa shift in trend at an unknown time. We focus on the additive outlier approach,but also give results for the innovational outlier approach. Various methods ofchoosing the break date are considered. New limiting distributions are derived,including the case where a shift in trend occurs under the unit root nullhypothesis. Limiting distributions are invariant to mean shifts but not toslope shifts. Simulations are used to assess finite sample size and power. We focuson the effects of a break under the null and the choice of break date.

13.PERRON, P., G. RODRIGUEZ.(2003) GLS detrending, efficient unit root tests and structural change. Journalof Econometrics, 115:1-27.

We extend the class of M-tests for a unit root analyzed by Perron and Ng (Rev.Econ. Studies63(1996)435)and Ng and Perron (Econometrica 69 (2001)1519)to the case whereachange in the trend function is allowed to occur at an unknown time.Thesetests (M GLS )adoptthe GLSdetrending approach developed by Elliott etal.(Econometrica 64 (1996)813)(ERS) following the results of Dufour and King(J.Econometrics 47 (1991)115).Following Perron (Econometrica 57 (1989)1361),weconsider two models:one allowing for a change in slope and the other for both achange in intercept and slope.We derive the asymptotic distributions of thetests as well as that of the feasible point optimal test (P GLS )suggested byERS.Also, we compute the non-centrality parameter used for the local GLSdetrendingthat permits the test P GLS T to have 50%asymptotic power at that value.The asymptoticcritical values of the tests are tabulated.We show that the M GLS and P GLS Ttests have an asymptotic power function close to the power envelope.Asimulation study analyzes the size and power in nite samples under variousmethods to select the truncation lag for the autoregressive spectral

density estimator.Anempirical application is also provided.

14.PERRON, P. (1997) Further evidenceon breaking trend functions in macroeconomic variables.Journal of Econometrics,80: 355-385.

This study first reexamines thefindings of Perron (1989) regarding the claim that most macroeconomic timeseries are best construed as stationary fluctuations around a deterministictrend function if allowance is made for the possibility of a shift in theintercept of the trend function in 1929 (a crash) and a shift in slope in 1973(a slowdown in growth). Unlike that previous study, the date of possible changeis not fixed a priori but is considered as unknown. We consider various methodsto select the break points and the asymptotic and finite sample distributionsof the corresponding statistics. A

detailed discussion about the choice ofthe truncation lag parameter in the autoregression and of its effect on thecritical values is also included. Most of the rejections reported in Perron(1989) are confirmed using this approach. Secondly, this paper investigates aninternational data set of post-war quarterly real GNP (or GDP) series for theG-7 countries. Our results are compared and contrasted to those of Banerjee etal. (1992) and Zivot and Andrews (1992). In contrast to the theoretical resultscontained in these papers, we derive the limiting distribution of thesequential test without trimming.


perron突变.rar

10.81 MB

已有 1 人评分学术水平 热心指数 收起 理由
黄帆帆 + 1 + 1 对论坛有贡献

总评分: 学术水平 + 1  热心指数 + 1   查看全部评分

使用道具

板凳
xuelida 在职认证  发表于 2013-7-11 02:05:24 |只看作者 |坛友微信交流群
new; cls;
let data=
80
78
71
73
70
71
72
76
76
78
80
80
77
69
69
68
67
66
67
70
69
68
69
69
68
63
63
63
58
60
57
53
55
65
64
62
64
64
66
69
70
69
65
64
63
60
62
60
61
60
;

y=data;
n=rows(y);
p=1;
x=seqa(1,1,n)^seqa(0,1,p+1)'; @生成常数项和趋势项@


w=wstat(y,x);
n=rows(w);
library pgraph;
graphset;
title("standardized recursive residuals");
xy(seqa(1,1,n),w);   


proc wstat(y,x);
local n,k,w,ylag,xlag,bhatlag,e,t,v;
   n=rows(x);
   k=cols(x);
   w=zeros(n-k,1);
   t=k+1;
   do while t<=n;      @递归开始@
      xlag=x[1:t-1,.];   
      ylag=y[1:t-1,.];
      bhatlag=inv(xlag'xlag)*xlag'*ylag;
      e=y[t,.]-x[t,.]*bhatlag;
      v=1+x[t,.]*inv(xlag'xlag)*x[t,.]';
      w[t-k,.]=e/sqrt(v);
      t=t+1;
   endo;
   retp(w);
endp;
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
zhaomn200145 + 5 + 5 + 5 奖励积极上传好的资料

总评分: 学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

使用道具

报纸
xuelida 在职认证  发表于 2013-7-11 02:15:34 |只看作者 |坛友微信交流群
上一个例子是递归残差的计算程序,使用同样的数据,则cusum检验程序如下所示:
/*使用标准的递归残差w,可以进行结构突变的CUSUM test         
null hypothesis is no structural change,test statistic:

    wj=(Sum[w] from i=1 to j)/sig.

sig是w的standard deviation,如果检验统计量高于上限或低于下限,拒绝零假设,
上限:wmax=theta*sqrt(n-k)+2*theta*(j-k)/sqrt(n-k)
下限:wmin=-wmax
这个程序不太难。

*/

call cusumtest(y,x);

proc(4)=cusumtest(y,x);
local theta,n,k,w,ylag,xlag,bhatlag,e,t,v,j,sig2,wj,wmin,wmax;
   theta=0.948;     @5% confidence level@
   /* standardized recursive residuals */
   n=rows(x);
   k=cols(x);
   w=zeros(n-k,1);
   t=k+1;
   do while t<=n;
      xlag=x[1:t-1,.];
      ylag=y[1:t-1,.];
      bhatlag=inv(xlag'xlag)*xlag'*ylag;
      e=y[t,.]-x[t,.]*bhatlag;
      v=1+x[t,.]*inv(xlag'xlag)*x[t,.]';
      w[t-k,.]=e/sqrt(v);
      t=t+1;
   endo;
   /* CUSUM test */
   j=seqa(k+1,1,n-k);
   sig2=(w-meanc(w))'(w-meanc(w))/(n-k);
   wj=cumsumc(w)./sqrt(sig2);
   wmax=theta*sqrt(n-k)+2*theta*(j-k)/sqrt(n-k);
   wmin=-wmax;
   if wj>=wmin and wj<=wmax;
      print "CUSUM test(RESULT:NOT reject H0)";            
   else;
      print "CUSUM test(RESULT:Reject H0)";
   endif;
   /* graph */
   library pgraph;
   graphset;
   _pltype={1,1,6};
   title("CUMSUM TEST"); xlabel("time j"); ylabel("CUSUM");
   xy(j,wmin~wmax~wj);
retp(j,wmin,wj,wmax);
endp;

使用道具

地板
xuelida 在职认证  发表于 2013-7-11 02:22:36 |只看作者 |坛友微信交流群
CUSUMSQ test
/*检验统计量:
qj=(Sum[w[i]^2] from i=1 to j)/(Sum[w[i]^2] from i=1 to n)
the upper bound qmax=c+(j-k)/(n-k)
the lower bound qmin=-c+(j-k)/(n-k)
*/

call cusumsqtest(y,x);

proc(4)=cusumsqtest(y,x);
   local c,n,k,w,ylag,xlag,bhatlag,e,t,v,qj,qmin,qmax,j;
   c=0.25379;   @c=0.25379 is the constant for 5% confidence level@
   /* standardized recursive residuals */
   n=rows(x); k=cols(x);
   w=zeros(n-k,1);
   t=k+1;
   do while t<=n;
      xlag=x[1:t-1,.]; ylag=y[1:t-1,.];
      bhatlag=inv(xlag'xlag)*xlag'*ylag;
      e=y[t,.]-x[t,.]*bhatlag;
      v=1+x[t,.]*inv(xlag'xlag)*x[t,.]';
      w[t-k,.]=e/sqrt(v);
      t=t+1;
   endo;
   /* CUSUMSQ test */
   j=seqa(k+1,1,n-k);
   qj=cumsumc(w^2)./sumc(w^2);
   qmax=c+(j-k)/(n-k);
   qmin=-c+(j-k)/(n-k);
   if qj>=qmin and qj<=qmax;
      print "CUSUMSQ test(RESULT:NOT reject H0)";           
   else;
      print "CUSUMSQ test(RESULT:Reject H0)";
   endif;
   /* graph */
   library pgraph;
   graphset;
   _pltype={1,1,6};
   title("CUSUMSQ test"); xlabel("time j"); ylabel("CUSUMSQ");
   xy(j,qmin~qmax~qj);
   retp(j,qmin,qj,qmax);
endp;
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
zhaomn200145 + 5 + 5 + 5 奖励积极上传好的资料

总评分: 学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

使用道具

7
xuehe 发表于 2013-7-12 05:44:22 |只看作者 |坛友微信交流群
比较前沿的研究!

使用道具

8
xuelida 在职认证  发表于 2013-7-12 10:53:59 |只看作者 |坛友微信交流群
我们先把结构突变的几种检验情形给大家,然后再引入到单位根里
下面是著名的chow检验,理论可见word附件。
/*Lesson2.6 Structural break: Chow test */
new;cls;
@情形1解释变量的扩展矩阵@
x1=(ones(n1,1)~zeros(n1,1)~x[1:n1,2:k])|(zeros(n-n1,1)~ones(n-n1,1)~x[(n1+1):n,2:k]);
@情形2解释变量的扩展矩阵@
x2 = (x[1:n1,.]~zeros(n1,k))|(zeros(n-n1,k)~x[(n1+1):n,.]);
rss = y’y - y’x*invpd(x’x)*x’y; @原模型的残差平方和RSS@
df = rows(x) - cols(x); @RSS自由度@
rss1 = y’y - y’x1*invpd(x1’x1)*x1’y; @情形1下的残差平方和RSS@
df1 = rows(x1) - cols(x1);
@The F test statistic for testing case 1 against the restricted model. @
f1 = ((rss - rss1)/(df1 - df)/(rss1/df1);
pv1 = cdffc(f1,df1-df,df1); @检验统计量的p-value@
rss2 = y’y - y’x2*invpd(x2’x2)*x2’y;
df2 = rows(x2) - cols(x2);
f2 = ((rss - rss2)/(df2 - df)/(rss2/df2);
pv2 = cdffc(f2,df2-df,df2);
@The F test statistic for testing case 2 against case 1. @
f = ((rss1 - rss2)/(df2 - df1)/(rss2/df2);
pv = cdffc(f,df2-df1,df2);

Chow结构变化检验.doc

39 KB

使用道具

9
xuelida 在职认证  发表于 2013-7-12 11:02:10 |只看作者 |坛友微信交流群
结构突变常用的形式是引入虚拟变量,假设虚拟变量向量为
d={0,0,....,0,1,1,....,1}.
然后beta参数的约束为

        R*beta=q
        R={0 0 1 0,
           0 0 0 1}
        q={0,
           0}.
两个约束,则无约束残差平方和为URSS=e'e ;
约束模型下的参数估计为,
        br=b+inv(x'x)*R'inv(R*inv(x'x)*R')*(q-R*b) @读者可以看green第6版的第4章@
计算约束残差平方和,
        RRSS=(y-x*br)'(y-x*br)
构建检验统计量,
        fstat=((RRSS-URSS)/k)/(URSS/(n-2*k))
*/
数据还是使用第一个例子中的。

call chow1d(y,x,25);


proc chow1d(y,x,nth);
   local n,k,d,xd,b,e,URSS,R,q,br,RRSS,fstat,pval;
   n=rows(x); k=cols(x);
   d=(seqa(1,1,n).>nth);
   xd=d.*x;
   x=x~xd;
   b=inv(x'x)*x'y;
   e=y-x*b;
   URSS=e'e;
   R=zeros(k,k)~eye(k);
   q=zeros(k,1);
   br=b+inv(x'x)*R'inv(R*inv(x'x)*R')*(q-R*b);
   RRSS=(y-x*br)'(y-x*br);  
   fstat=((RRSS-URSS)/k)/(URSS/(n-2*k));  /* ~F(k,n-2k) under H0 */
   pval=cdffc(fstat,k,n-2*k);
   if pval>=0.05;
      print "Chow test (RESULT:Not reject H0: beta1=beta2)";
   else;
      print "Chow test (RESULT:Reject H0: beta1=beta2)";
   endif;
   print "F stat =" fstat;
   print "p-value=" pval;
   print "beta for the first  group:" b[1:k]';
   print "beta for the second group:" (b[1:k]+b[k+1:2*k])';
   print;
   retp(fstat);
endp;

该结果为,
Chow test (RESULT:Reject H0: beta1=beta2)
        F stat =       9.5808842
        p-value=   0.00033234893
        beta for the first  group:       77.060000      -0.38615385
        beta for the second group:       57.840000       0.12000000
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
zhaomn200145 + 5 + 5 + 5 奖励积极上传好的资料

总评分: 学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

使用道具

10
xuelida 在职认证  发表于 2013-7-12 11:09:10 |只看作者 |坛友微信交流群
读者可以练习截距突变、斜率突变和截距与斜率均突变的三种情形
比如,我们设置一个全局变量,nk={0};表示截距突变项;
在调用proc时,设置局部变量nth,已知的突变时间点;
设置虚拟变量 d=(seqa(1,1,n).>nth);
构造结构突变的解释变量xd=d.*x[.,nk+1];

nk={0};
print "intercept:";
call chow1dd(y,x,25,nk);
nk={1};
print "slope:";
call chow1dd(y,x,25,nk);
nk={0,1};
print "intercept and slope:";
call chow1dd(y,x,25,nk);

proc chow1dd(y,x,nth,nk);
   local n,k,k1,d,xd,b,e,URSS,R,q,br,RRSS,fstat,pval;
   n=rows(x); k=cols(x); k1=rows(nk);
   d=(seqa(1,1,n).>nth);
   xd=d.*x[.,nk+1];
   x=x~xd;
   b=inv(x'x)*x'y;
   e=y-x*b;
   URSS=e'e;
   R=zeros(k1,k)~eye(k1);
   q=zeros(k1,1);
   br=b+inv(x'x)*R'inv(R*inv(x'x)*R')*(q-R*b);
   RRSS=(y-x*br)'(y-x*br);  
   fstat=((RRSS-URSS)/k1)/(URSS/(n-k-k1));  /* ~F(k1,n-k-k1) under H0 */
   pval=cdffc(fstat,k1,n-k-k1);
   if pval>=0.05;
      print "Chow test (RESULT:Not reject H0: beta1=beta2)";
   else;
      print "Chow test (RESULT:Reject H0: beta1=beta2)";
   endif;
   print "F stat =" fstat;
   print "p-value=" pval;
   print;
   retp(fstat);
endp;
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
zhaomn200145 + 5 + 5 + 5 奖励积极上传好的资料

总评分: 学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-28 12:49