关于本站
人大经济论坛-经管之家:分享大学、考研、论文、会计、留学、数据、经济学、金融学、管理学、统计学、博弈论、统计年鉴、行业分析包括等相关资源。
经管之家是国内活跃的在线教育咨询平台!
经管之家新媒体交易平台
提供"微信号、微博、抖音、快手、头条、小红书、百家号、企鹅号、UC号、一点资讯"等虚拟账号交易,真正实现买卖双方的共赢。【请点击这里访问】
期刊
- 期刊库 | 马上cssci就要更新 ...
- 期刊库 | 【独家发布】《财 ...
- 期刊库 | 【独家发布】“我 ...
- 期刊库 | 【独家发布】“我 ...
- 期刊库 | 【独家发布】国家 ...
- 期刊库 | 请问Management S ...
- 期刊库 | 英文期刊库
- 核心期刊 | 歧路彷徨:核心期 ...
TOP热门关键词
这个代码我调试过,添加了缺少的函数文件ols.m,但是依然还有10%的错误,本来用markdown发帖,但是贴了主程序1100行的代码,太大导致无法发出去。所以就算了。这里插入一个函数计算band-passfilter的。functionyf=BP ...
免费学术公开课,扫码加入 |
这里插入一个函数计算 band-pass filter的。
- function yf=BPF(y,up,dn,K)
- % bpf.m
- % Program to compute band-pass filtered series
- % Inputs are
- %y: data (rows = observations, columns=series)
- %up:period corresponding to highest frequency (e.g., 6)
- %dn:period corresponding to lowest frequency (e.g., 32)
- %K: number of terms in approximating moving average
- %[calls filtk.m (filter with symmetric weights) as subroutine]
- x=[up dn];
- disp(' ')
- disp('bpf(y,up,dn,K): band-pass filtering of series y with symmetric MA(2K+1)')
- disp(' ')
- disp(' for additional information see: ')
- disp(' ')
- disp(' M. Baxter and R.G. King ')
- disp(' ')
- disp(' Measuring Business Cycles: ')
- disp(' Approximate Band-Pass Filters')
- disp(' for Macroeconomic Time Series')
- disp(' ')
- disp('Filter extracts components between periods of: ')
- disp(' up dn')
- disp(x)
- % pause(2)
- if (up>dn)
- disp('Periods reversed: switching indices up & dn')
- disp(' ')
- dn=x(1); up=x(2);
- end
- if (up<2)
- up=2;
- disp('Higher periodicity > max: Setting up=2')
- disp(' ')
- end
- % convert to column vector
- [r c]=size(y);
- if (r<c)
- y=y';
- disp('There are more columns than rows: Transposing data matrix')
- disp(' ')
- end
- % Implied Frequencies
- omubar=2*pi/up;
- omlbar=2*pi/dn;
- % An approximate low pass filter, with a cutoff frequency of "ombar",
- % has a frequency response function
- %
- %alpha(om) = a0 + 2*a1 cos(om) + ... 2*aK cos(K om)
- %
- % and the ak's are given by:
- %
- % a0 = ombar/(pi) ak = sin(k ombar)/(k pi)
- %
- % where ombar is the cutoff frequency.
- % A band-pass filter is the difference between two
- % low-pass filters,
- % bp(L) = bu(L) - bl(L)
- % with bu(L) being the filter with the high cutoff point and bl(L) being
- % that with the low cutoff point.Thus, the weights are differences
- % of weights for two low-pass filters.
- % Construct filter weights for bandpass filter (a(0)....a(K)).
- akvec=zeros(1,K+1);
- akvec(1)=(omubar-omlbar)/(pi);% weight at k=0
- for k=1:K;
- akvec(k+1)=(sin(k*omubar)-sin(k*omlbar))/(k*pi); % weights at k=1,2,...K
- end
- % Impose constraint on frequency response at om = 0
- % (If high pass filter, this amounts to requiring that weights sum to zero).
- % (If low pass filter, this amounts to requiring that weights sum to one).
- if (dn>1000)
- disp('dn > 1000: assuming low pass filter')
- phi=1;
- else
- phi=0;
- end
- % sum of weights without constraint
- theta=akvec(1)+2*sum(akvec(2:K+1));
- % amount to add to each nonzero lag/lead to get sum = phi
- theta=(phi-theta)/(2*K+1);
- % adjustment of weights
- akvec=akvec+theta;
- % filter the time series
- yf=filtk(y,akvec);
- if (r<c)
- yf=yf';
- end
插入附件,特别大也许会消耗论坛流量,因为有143M 这样大。 文件夹里有数据、主程序脚本文件、函数文件。 希望对大家的学习有帮助,未来三年推动国内的动态宏观经济学建模向国际一流接近。
因为太大所以我用了网盘,发链接吧。
链接:https://pan.baidu.com/s/1XyKiuoi5g5r_8L2Qregjhw
提取码:取消密码公布
「经管之家」APP:经管人学习、答疑、交友,就上经管之家!
免流量费下载资料----在经管之家app可以下载论坛上的所有资源,并且不额外收取下载高峰期的论坛币。
涵盖所有经管领域的优秀内容----覆盖经济、管理、金融投资、计量统计、数据分析、国贸、财会等专业的学习宝库,各类资料应有尽有。
来自五湖四海的经管达人----已经有上千万的经管人来到这里,你可以找到任何学科方向、有共同话题的朋友。
经管之家(原人大经济论坛),跨越高校的围墙,带你走进经管知识的新世界。
扫描下方二维码下载并注册APP
免流量费下载资料----在经管之家app可以下载论坛上的所有资源,并且不额外收取下载高峰期的论坛币。
涵盖所有经管领域的优秀内容----覆盖经济、管理、金融投资、计量统计、数据分析、国贸、财会等专业的学习宝库,各类资料应有尽有。
来自五湖四海的经管达人----已经有上千万的经管人来到这里,你可以找到任何学科方向、有共同话题的朋友。
经管之家(原人大经济论坛),跨越高校的围墙,带你走进经管知识的新世界。
扫描下方二维码下载并注册APP
您可能感兴趣的文章
本站推荐的文章
人气文章
本文标题:DSGE动态经济学建模Band-Pass filter 程序分享
本文链接网址:https://bbs.pinggu.org/jg/kaoyankaobo_kaoyan_8671186_1.html
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。