这个算法可以在R, Matlab,或者 Python中调用。
在R中,已经做成一个package,可以直接用install.packages("Rbeast")安装
- install.packages("Rbeast")
- library(Rbeast)
- data(Nile) # annual streamflow of the Nile River
- out = beast(Nile, season='none') # 'none': trend-only data without seasonlaity
- print(out)
- plot(out)
在Python中,已经做成一个package放在https://github.com/zhaokg/Rbeast/tree/master/Matlab手动下载:
- beastPath = 'c:\beast' % 本地安装目录
- eval(webread('http://b.link/rbeast',weboptions('cert',''))) % 自动安装在beastPath指定目录
- load('Nile.mat') % 尼罗河年径流量
- out = beast(Nile, 'season', 'none','start', 1871) % trend-only data without seasonality
- printbeast(out)
- plotbeast(out)
- %下图为这个例子的结果
- %第一个截屏是 突变点个数的概率,比如说有54%的概率存在1个突变点
- %第二个截屏是 画出的主要结果
Matlab中另外一个例子
- load('googletrend.mat') % 美国自2004年每月在Google搜索'beach'关键词的频度:这个时间序列有一个周期项
- o = beast( beach ) % Apply BEAST to the 'beach time series: beach is a data vector only; the time
- % info can be supplied using the start and deltat
- % keywords, as in the next commented line
- %o = beast( beach,'start',[2004,1],'deltat',1/12 )
- printbeast(o) % print the changepoints detected
- plotbeast(o) % plot the results: o.season.Y and o.trend.Y are the seasonal and trend compoents




雷达卡



京公网安备 11010802022788号







