Structural Break in Time Series

조회 수: 14 (최근 30일)
syed shah
syed shah 2021년 9월 10일
답변: Kaiguang Zhao 2022년 4월 2일
Hi,
I am new to Matlab and modeling a Financial Time Series. I can see there is break in mean and volatility in series but don't know how to model in Matlab.
I was using Eviews to model such series by introducing a dummy variable but no such option is available in Matlab.
Appreciate your help please.
Cheers
Syed

답변 (1개)

Kaiguang Zhao
Kaiguang Zhao 2022년 4월 2일
Not familar with Eviews, but here are some thoughts borrowed from the answer to similar questions asked here. For self-ego, the example mentioned below is based on a Matlab tool I developed.
Numerous algorithms are possible to detect structural breaks (aka breakpoints or changepoints). Typically, the results are sensitive to the choice of algorithms. For those who may need a Bayesian alternative for time series changepoint detection, one such Matlab implemenation is available here from this FileExchange entry, which is developed and maintained by me. The algorithm is called BEAST. It can be instantly installed by running eval(webread('http://b.link/beast',weboptions('cert',''))). Below is a quick example using a simulated time series:
% Quick installation of BEAST to a temporary path on your local drive
eval(webread('http://b.link/beast',weboptions('cert','')))
% A simulated time series from another quesiton asked in this forum
y = [zeros(1,100) 1:100 99:-1:50 50*ones(1,250)] + 10*rand(1,500);
% Apply beast to y. Here season='none' indicates that y has no periodic/seasonal component
o = beast(y, 'season','none')
printbeast(o)
plotbeast(o)
Here is a summary of the number and locations of the breakpoints (i.e., changepoints) detected:
#####################################################################
# Trend Changepoints #
#####################################################################
.-------------------------------------------------------------------.
| Ascii plot of probability distribution for number of chgpts (ncp) |
.-------------------------------------------------------------------.
|Pr(ncp = 0 )=0.000|* |
|Pr(ncp = 1 )=0.000|* |
|Pr(ncp = 2 )=0.000|* |
|Pr(ncp = 3 )=0.914|*********************************************** |
|Pr(ncp = 4 )=0.083|***** |
|Pr(ncp = 5 )=0.002|* |
|Pr(ncp = 6 )=0.000|* |
|Pr(ncp = 7 )=0.000|* |
|Pr(ncp = 8 )=0.000|* |
|Pr(ncp = 9 )=0.000|* |
|Pr(ncp = 10)=0.000|* |
.-------------------------------------------------------------------.
| Summary for number of Trend ChangePoints (tcp) |
.-------------------------------------------------------------------.
|ncp_max = 10 | MaxTrendKnotNum: A parameter you set |
|ncp_mode = 3 | Pr(ncp= 3)=0.91: There is a 91.4% probability |
| | that the trend component has 3 changepoint(s).|
|ncp_mean = 3.09 | Sum{ncp*Pr(ncp)} for ncp = 0,...,10 |
|ncp_pct10 = 3.00 | 10% percentile for number of changepoints |
|ncp_median = 3.00 | 50% percentile: Median number of changepoints |
|ncp_pct90 = 3.00 | 90% percentile for number of changepoints |
.-------------------------------------------------------------------.
| List of probable trend changepoints ranked by probability of |
| occurrence: Please combine the ncp reported above to determine |
| which changepoints below are practically meaningful |
'-------------------------------------------------------------------'
|tcp# |time (cp) |prob(cpPr) |
|------------------|---------------------------|--------------------|
|1 |199.000000 |1.00000 |
|2 |252.000000 |0.92867 |
|3 |96.000000 |0.89042 |
|4 |471.000000 |0.01800 |
|5 |413.000000 |0.00733 |
|6 |435.000000 |0.00692 |
|7 |483.000000 |0.00679 |
|8 |448.000000 |0.00579 |
|9 |343.000000 |0.00204 |
|10 |63.000000 |0.00154 |
.-------------------------------------------------------------------.
Below is the plot. The trend is fitted using a piecewise polynomial model. Again, as a Bayesian method, BEAST assumes the order of the polynomials for individual segments as uknowns. The orders of the polynomial needed to adequately fit the trend are estimated over time, as depicted iin the tOrder subplot below. The 1st and 4th segments are flat lines, so their estimated polynomial orders are close to zeros.

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by