lppl.confidence.B: Compute the LPPLS Confidence indicator which satisfies the...

Description Usage Arguments Details Value References Examples

View source: R/LPPL_confidence.R

Description

This function computes the LPPLS Confidence indicator which satisfies the filtering conditions used by Fantazzini (2016)

Usage

1
2
3
4
5
6
7
lppl.confidence.B(
  x,
  time.scale,
  max.window,
  step.shrinking.window,
  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

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). 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 fraction of fitted LPPL satisfying the filtering conditions for a positive bubble and a negative bubble, and the crash lock-in plot are all reported in a single plot with 3 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.

- 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.

- 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 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)

- 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
 ## 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]))
 b1<-lppl.confidence.B(x=dat,time.scale=750,max.window=600,step.shrinking.window=150,clust_number=8)
 b1
 
## End(Not run)

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