lppl.confidence.trust.B: Compute the LPPLS Confidence and Trust indicators which...

Description Usage Arguments Details Value References Examples

View source: R/LPPL_confidence_trust.R

Description

This function the LPPLS Confidence and Trust indicators which satisfy the filtering conditions used by Fantazzini (2016)

Usage

1
2
3
4
5
6
7
8
lppl.confidence.trust.B(
  x,
  time.scale,
  max.window,
  step.shrinking.window,
  boot.rep,
  clust_number
)

Arguments

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

boot.rep

is the number of bootstrp replications used to compute the LPPL trust indicator at each ending point t2

clust_number

is the number of clusters for parallel computation

Details

This function computes the LPPLS Confidence indicator which satisfies the filtering conditions used by Fantazzini (2016). 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 1 step and a new LPPL estimation is performed with window size (t2-t1+1); this process continues till the estimation window size is (t2-t1+max.window). As a consequence, there are (max.window+1) estimations for each endpoint t2, which are then used to compute the filtering conditions used by Fantazzini (2016), which is comparable to the DS LPPL Confidence indicator. For each endpoint t2, the DS LPPL Trust indicator is also computed: this is the median level over the [max.window/step.shrinking.window+1] estimations windows of the fraction among the boot.rep synthetic time series that satisfy the filtering conditions used by Fantazzini (2016). The synthetic time series are created by resampling boot.rep times the LPPL residuals and adding them to the calibrated LPPLS structure. The estimated parameters and indicators with the rolling LPPL regression are saved in the xts object lppl.roll. The original price series (with a positive bubble period highlighted in light red, while a negative bubble in light green), the DS LPPL Confidence and Trust indicators for a positive bubble and a negative bubble, and the crash lock-in plot are all reported in a single plot with 4 rows. The filtering conditions used by Fantazzini (2016) are reported below:

- Positive bubble: 0<beta<1, B<0, b=[- B x beta - |C| x sqrt(beta^2+omega^2)]>0 (hazard rate), LPPL residuals stationary at the 5% level (using the KPSS test statistic)

- Negative bubble: 0<beta<1, B>0, b=[- B x beta - |C| x sqrt(beta^2+omega^2)]<0 (hazard rate), LPPL residuals stationary at the 5% level (using the KPSS test statistic)

Value

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

- confidence.pos.bub: the average fraction of fitting windows for which the LPPLS calibrations satisfy the filtering conditions used by Fantazzini (2016) for a positive bubble. This is called the LPPL Confidence indicator for positive bubbles.

- confidence.neg.bub: the average fraction of fitting windows for which the LPPLS calibrations satisfy the filtering conditions used by Fantazzini (2016) for a negative bubble. This is called the LPPL Confidence indicator for negative bubbles.

- Trust.pos.bub: the median level over the [max.window/step.shrinking.window+1] estimations windows of the fraction among the boot.rep synthetic time series that satisfy the filtering conditions used by Fantazzini (2016) for a positive bubble. The synthetic time series are created by resampling boot.rep times the LPPL residuals and adding them to the calibrated LPPLS structure.

- Trust.neg.bub: the median level over the [max.window/step.shrinking.window+1] estimations windows of the fraction among the boot.rep synthetic time series that satisfy the filtering conditions used by Fantazzini (2016) for a negative bubble. The synthetic time series are created by resampling boot.rep times the LPPL residuals and adding them to the calibrated LPPLS structure.

- 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 4 components:

- the original price series (with a positive bubble period highlighted in light red, while a negative bubble in light green)

- the fraction of fitted LPPL satisfying the filtering conditions for a positive bubble and a negative bubble (over time), that is the DS LPPL Confidence indicator.

- the DS LPPL Trust indicator.

- the crash lock-in plot, that is the rolling estimates for the critical time tc

References

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 ## Not run: 
 # Example 1: Compute the LPPL confidence indicator  with the SP500 prices
 from 1791 till 2015 (adjusted for dividends and splits), using a 269-month time scale
 data(sp500)
 ctb=lppl.confidence.trust.B(x=sp500,time.scale=269,max.window=120,
 step.shrinking.window=10,boot.rep=100,clust_number=7)
 ctb

 ## Example 2: replicate the example in Sornette et al. (2015) but using the criteria proposed
 # by Fantazzini (2016) and Geraskin and Fantazzini (2013)
 library(quantmod)
 SSE<-getSymbols("000001.SS",auto.assign=FALSE,from=as.Date("2012-07-01"), to=as.Date("2015-07-31"))
 sse.adj <- SSE[,"000001.SS.Adjusted", drop = F]
 head(sse.adj)
 ctb=lppl.confidence.trust.A(x=sse.adj,time.scale=250,max.window=120,
 step.shrinking.window=10,boot.rep=10,clust_number=7)
 ctb

 ### Example 3: Compute the LPPL trust 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]))
 b1<-lppl.confidence.trust.B(x=dat,time.scale=750,max.window=600,step.shrinking.window=150,
 boot.rep=10,clust_number=8)
 b1
 
## End(Not run)

deanfantazzini/bubble documentation built on Oct. 22, 2020, 2:43 p.m.