Giter VIP home page Giter VIP logo

lppls-appliance's Introduction

Log Periodic Power Law Singularity (LPPLS) Model

The LPPLS model provides a flexible framework to detect bubbles and predict regime changes of a financial asset. A bubble is defined as a faster-than-exponential increase in asset price, that reflects positive feedback loop of higher return anticipations competing with negative feedback spirals of crash expectations. It models a bubble price as a power law with a finite-time singularity decorated by oscillations with a frequency increasing with time.

Here is the model:

LPPLS Model

where:

  • Expected Log Price Colon Equals expected log price at the date of the termination of the bubble
  • Critical Time Colon Equals critical time (date of termination of the bubble and transition in a new regime)
  • A Colon Equals expected log price at the peak when the end of the bubble is reached at Critical Time
  • B Colon Equals amplitude of the power law acceleration
  • C Colon Equals amplitude of the log-periodic oscillations
  • m Colon Equals degree of the super exponential growth
  • omega Colon Equals scaling ratio of the temporal hierarchy of oscillations
  • phi Colon Equals time scale of the oscillations

We implemented the Multi-Level Single-Linkage algorithm (with local optimizer L-BFGS-B) to fit the model using the reparametrization of the model according to recent papers of Dr. Sornette and others.

The repository contains the script (fitter.R) to fit the model on multiple time windows (shrinking) and the script (new_search_xxx.R) to derive the confidence indicator based on the output of fitter.R. However in the folder "data" you can find the .csv files with the confidence indicator already computed.

The confidence indicators are divided according to different time windows size.

  1. SS -> Super-Short time scale: (40,183) days
  2. S -> Short time scale: (40,365) days
  3. M -> Medium time scale: (365,730) days
  4. L -> Long time scale: (730,1460) days

They are also divided in Early Warning (EW) and End Flag (EF) based on filtering condition. So for example, the Super-Short Early Warning indicator is SS_EW and the End Flag is SS_EF and so on.

DOWNLOAD FULL PROJECT AND RESULTS -> https://mega.nz/folder/Do9ESJaT#uoT8s09UZqGPYvrrHTgGmA

lppls-appliance's People

Contributors

sabato96 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lppls-appliance's Issues

Nice attempt

Try to use the Lagrangian Regualarizer in Dr. Sornette's recent paper he uses it to estimate the bubble inception date and then fits from that point

Subscript out of bounds error

Trying it out and running new_search_SP500.R.

This is the output. Are there any missing files that are needed?

── Attaching packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.3.1 ──
✔ ggplot2 3.3.3purrr   0.3.4tibble  3.1.1dplyr   1.0.5tidyr   1.1.3stringr 1.4.0readr   1.4.0forcats 0.5.1
── Conflicts ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
Loading required package: xts
Loading required package: zoo

Attaching package:zooThe following objects are masked frompackage:base:

    as.Date, as.Date.numeric


Attaching package:xtsThe following objects are masked frompackage:dplyr:

    first, last

Loading required package: TTR
Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo 

Attaching package:lubridateThe following objects are masked frompackage:base:

    date, intersect, setdiff, union

Loading required package: foreach

Attaching package:foreachThe following objects are masked frompackage:purrr:

    accumulate, when

Loading required package: iterators
Loading required package: lattice

Attaching package:latticeExtraThe following object is masked frompackage:ggplot2:

    layer

Error in df[[j]] : subscript out of bounds
Execution halted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.