Description Usage Arguments Details Value References Examples
View source: R/LPPL_confidence.R
This function computes the LPPLS Confidence indicator which satisfies the filtering condition 1 in Table 1 by Sornette et al. (2015)
1 2 3 4 5 6 7 | lppl.confidence.A(
x,
time.scale,
max.window,
step.shrinking.window,
clust_number
)
|
x |
is a T x 1 numeric data vector (or xts object) |
time.scale |
is the (maximum) rolling window size |
max.window |
is the maximum amount to be substracted from time.scale to create shrinking estimation windows. The initial maximum rolling window size for estimating the LPPL model is time.scale (=t2-t1); then, the window size is decreased by the amount given by step.shrinking.window and a new LPPL estimation is performed with window size (t2-t1+step.shrinking.window); this process continues till the estimation window size is (t2-t1+max.window). As a consequence, there are [max.window/step.shrinking.window+1] estimations with endpoint given by t2, whereas the starting dates are given by t1+i, where i=0,step.shrinking.window,2*step.shrinking.window...,max.window. |
step.shrinking.window |
is the amount by which the time.scale is decreased at each step |
clust_number |
is the number of clusters for parallel computation |
This function computes the LPPLS Confidence indicator which satisfies the filtering condition 1 in Table 1 by Sornette et al. (2015). More specifically, it estimates the LPPL model using the 3-step procedure by Geraskin and Fantazzini (2013) and Fantazzini (2016) where, for each endpoint t2, the initial maximum rolling window size for estimating the LPPL model is time.scale (=t2-t1); then, the window size is decreased by the amount given by step.shrinking.window and a new LPPL estimation is performed with window size (t2-t1+step.shrinking.window); this process continues till the estimation window size is (t2-t1+max.window). As a consequence, there are [max.window/step.shrinking.window+1] estimations with endpoint given by t2, whereas the starting dates are given by t1+i, where i=0,step.shrinking.window,2*step.shrinking.window...,max.window. All these estimations are then used to compute the filtering conditions 1 in Table 1 by Sornette et al. (2015). The estimated parameters and indicators with the rolling LPPL regression are saved in the xts object lppl.roll. The original price series (with the bubble period highlighted in light red), the fraction of fitted LPPL satisfying the filtering condition 1, and the crash lock-in plot are all reported in a single plot with 3 rows.
lppl.roll is a xts object containing the following columns:
- bet: the average estimate of the LPPL parameter beta over all rolling estimation window sizes with endpoint t2, where t2=time.scale,time.scale+1, ..., T
- ome: the average estimate of the LPPL parameter omega over all rolling estimation window sizes with endpoint t2, where t2=time.scale,time.scale+1, ..., T
- phi: the average estimate of the LPPL parameter phi over all rolling estimation window sizes with endpoint t2, where t2=time.scale,time.scale+1, ..., T
- A: the average estimate of the LPPL parameter A over all rolling estimation window sizes with endpoint t2, where t2=time.scale,time.scale+1, ..., T
- B: the average estimate of the LPPL parameter B over all rolling estimation window sizes with endpoint t2, where t2=time.scale,time.scale+1, ..., T
- C: the average estimate of the LPPL parameter C over all rolling estimation window sizes with endpoint t2, where t2=time.scale,time.scale+1, ..., T
- tc: the average estimate of the LPPL parameter tc (= the critical time) over all rolling estimation window sizes with endpoint t2, where t2=time.scale,time.scale+1, ..., T. It is reported as number of rows.
- length: the average length of the estimation window over all rolling estimation window sizes with endpoint t2, where t2=time.scale,time.scale+1, ..., T
- num.osc: the average estimate of the LPPL indicator called 'number of oscillations' (=omega/(2*pi) x log(abs((tc-t1)/(tc-t2))) ) over all rolling estimation window sizes with endpoint t2, where t2=time.scale,time.scale+1, ..., T
- damping: the average estimate of the LPPL indicator called 'Damping' (= (beta x abs(B))/(omega x abs(C)) ) over all rolling estimation window sizes with endpoint t2, where t2=time.scale,time.scale+1, ..., T
- rel.err: the average estimate of the LPPL indicator called 'relative error' (= abs((Y-Yfit)/Yfit) ) over all rolling estimation window sizes with endpoint t2, where t2=time.scale,time.scale+1, ..., T.
- lppl.Confidence: the average fraction of fitting windows for which the LPPLS calibrations satisfy the filtering condition 1 in Table 1 by Sornette et al. (2015). This is called the LPPL Confidence indicator.
- col.index: numerical sequential index from 1 to the total number of rows of the final xts object.
- crash lock-in: same information as in tc, but in date format.
The function also compute a plot with 3 components:
- the original price series (with the bubble period highlighted in light red)
- the fraction of fitted LPPL satisfying the filtering condition 1 (over time)
- the crash lock-in plot, that is the rolling estimates for the critical time tc
Fantazzini, D. (2016). The oil price crash in 2014/15: Was there a (negative) financial bubble?. Energy Policy, 96, 383-396.
Geraskin, P., & Fantazzini, D. (2013). Everything you always wanted to know about log-periodic power laws for bubble modeling but were afraid to ask. The European Journal of Finance, 19(5), 366-391.
Sornette, D., Demos, G., Qun, Z., Cauwels, P., Zhang, Q. (2015). Real-time prediction and post-mortem analysis of the Shanghai 2015 stock market bubble and crash. Journal of Investment Strategies, 4(4), 77-95.
Zhang, Q., Sornette, D., Balcilar, M., Gupta, R., Ozdemir, Z. A., Yetkiner, H. (2016). LPPLS bubble indicators over two centuries of the SP500 index. Physica A: Statistical Mechanics and its Applications, 458, 126-139.
1 2 3 4 5 6 7 8 9 10 | ## Not run:
#Compute the LPPL confidence indicator with bitcoin prices
#load data on bitcoin downloaded from coindesk: http://www.coindesk.com/price/
path.bit <- system.file("extdata", "coindesk-bpi-USD-close.csv", package = "bubble")
dat <- read.table(path.bit, dec = ".", sep =",", header = TRUE)
dat <- xts(dat[,2], order.by=as.Date(dat[,1]))
a1<-lppl.confidence.A(x=dat,time.scale=750,max.window=600,step.shrinking.window=150,clust_number=8)
a1
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.