| 所在主题: | |
| 文件名: g7.rar | |
| 资料下载链接地址: https://bbs.pinggu.org/a-1004930.html | |
| 附件大小: | |
|
小妹正研讀景氣循環相關的研究,一直以來都是算數學的、從沒寫過程式,教授說找篇paper的程序跑跑看就知道了,誰知道從Mark Watson教授他個人網頁上下載下來的Gauss檔運行不能,雖然查了錯誤代碼知道哪行那裡說哪裡錯了,但卻不會改,懇請版上高手替小妹看看:
附上完整程序檔:(gss裡面是Gauss檔、rts裡為RATS檔) 以下具題提出疑問: 第一個:在下面貼出來的這子程序"rwkfilt.prc"的錯誤代碼是 Line 33 in C:\Users\shyngc1987\Documents\paper_resources\code_stock and watson, 2003\g7\gss\rwkfilt.prc Syntax error G0008 : 'endp' 根據小妹查到的錯誤代碼指示G0008要馬少了符號要馬寫錯了,但都不像阿、endp不是一個很普通的關閉的指令嗎? @ rwkfilt.prc, 4/6/96, mww This is the kalman Filter for the model: y(t) = b(t) + e(t) (Scalar) b(t) = b(t-1) + a(t) (Scalar) where var(e)=r and var(a)=q; Input:y(t) b1 = b(t-1/t-1) p1 = p(t-1/t-1) r q output: b1 = b(t/t) p1 = p(t/t) n= y(t)-y(t/t-1) h= var(n) @ proc(6) = rwkfilt(y,b1,p1,r,q); local b2, p2, k, h, n; b2=b1; p2=p1+q; n=y-b2; h=p2+r; k=p2/h; b1=b2+k*n; p1=p2-k*p2; retp(b1,p1,b2,p2,n,h); endp; 第二個: 在這poist.prc子程序裡的錯誤代碼是 Line 1 in C:\Users\shyngc1987\Documents\paper_resources\code_stock and watson, 2003\g7\gss\poist.prc Nested procedure definition G0155 查了一下錯誤代碼說是第一行的定義pro的地方出錯了,看了手冊還是看不出這一行只是定義到底哪裡出錯了==" 唯一能懷疑的大概只有proc(*) 中間這個*到底是甚麼意思、該令為多少,懇請高手替小妹解答!! proc(1) = poist(y,tau,imean,itst); /* -- poist.prc, mww, 5/29/96 (revised) Calculate POI test statistic for stochastic trend model: H0: SD(a) = 0 vs. HA: SD(a) = tau y(t) = b(t) + e(t) b(t-1) = b(t-1) + a(t) the value of b(0) is an unknown nuissance parameter the SD of e(t) is 1 imean = 0 =>Construct Exact GLS Estimate = 1 Construct Asymptotic Approximation itst = 0 =>Construct Exact POI Statistic (given estimate of mean) = 1 Construct Asymptotic Approximation */ local e0, ss0, vague, b1, p1, r, q, t, balt, n, h, nt, ht, e1, ss1; local b2,p2, b1t, b2t, p1t, p2t, b3, p3, g; local theta, s, hs, ee, yf, poitst; theta=1-tau; @Approximate MA(1) Coefficient for FD of y @ g=tau*rows(y); @Local to unity parameter @ @ -- Residuals under the null -- @ e0=y-meanc(y); ss0=e0'e0; @ -- Estimate of b(0) under alternative -- @ if imean .== 0; vague=1.0E+8; @ -- Vague Prior -- @ b1=0; p1=vague; r=1; q=tau.^2; b1t=zeros(rows(y),1); b2t=zeros(rows(y),1); p1t=zeros(rows(y),1); p2t=zeros(rows(y),1); t=1; do while t <= rows(y); b1t[t]=b1; p1t[t]=p1; {b1,p1,b2,p2,n,h}=rwkfilt(y[t],b1,p1,r,q); b2t[t]=b2; p2t[t]=p2; t=t+1; endo; b3=b1; p3=p1; t=rows(y); do while t >= 1; b2=b2t[t]; p2=p2t[t]; b1=b1t[t]; p1=p1t[t]; {b3,p3}=rwksmth(b1,b2,b3,p1,p2,p3); t=t-1; endo; balt=b3; endif; if imean .== 1; s=seqa(1,1,rows(y))/rows(y); hs=exp(-g*s) + exp(-g*(2*ones(rows(y),1)-s)); hs=hs*g/(rows(y)*(1-exp(-2*g))); balt=hs'y; endif; if itst .== 0; r=1; q=tau.^2; @ -- Find Filtered Residuals under alternative -- @ nt=zeros(rows(y),1); ht=zeros(rows(y),1); b1=balt; p1=0; t=1; do while t <= rows(y); {b1,p1,b2,p2,n,h}=rwkfilt(y[t],b1,p1,r,q); nt[t]=n; ht[t]=h; t=t+1; endo; e1=nt./sqrt(ht); endif; if itst .== 1; y=y-balt; ee=0; yf=recserar(y,ee,theta); yf=0|yf[1:rows(y)-1]; yf=g*yf/rows(y); e1=y-yf; e1=e1*sqrt(1-tau); @ This improves small sample approximation @ endif; ss1=e1'e1; poitst=rows(y)*(1-(ss1/ss0)); retp(poitst); endp; |
|
熟悉论坛请点击新手指南
|
|
| 下载说明 | |
|
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。 2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。 3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。 (如有侵权,欢迎举报) |
|
京ICP备16021002号-2 京B2-20170662号
京公网安备 11010802022788号
论坛法律顾问:王进律师
知识产权保护声明
免责及隐私声明