lppl.validates: Estimation of the LPPL model using a nonlinear optimization

Description Usage Arguments Value Examples

View source: R/Validate_LPPL.R

Description

This function estimates a LPPL model using a nonlinear optimization

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
lppl.validates(
  tradedate,
  price,
  mb = c(1:3),
  MovingWindows = c(5:10),
  Right_days = 60,
  Right_scale = 0.8,
  Left_days = 262,
  h = 1.5,
  gaRunCnt = 100,
  gaGenerations = 500,
  gaPopulation = 200,
  gaElitism = 0.5,
  gaMutation = 0.1,
  gaCrossover = 0.8
)

Arguments

tradedate

Use a "Date" type vector as the transaction date.

price

Closing price numeric data vector

mb

The LPPL model is estimated using only the data from the critical point to the specified number of days (mb x 20 days). The data mb has a vector type, and the estimated data for each mb specified is returned. The default value is 1 to 3 months.

MovingWindows

This is the size of the window used to detect the peak point in the PeakDetection operation, and input as vector data. The default value is 5 to 10 days.

Right_days

It implements that the peak should drop by 25% during the right_days (60 days) period, and the default value is 60.

Right_scale

set the percentage of drop price from peak price. (Default : 0.8)

Left_days

The peak of critical time is higher than any peak prior to 262 days (Default : 262)

h

Parameter for peak detection. Parameter is a positive coefficient, meaning that the higher the value of h, the tighter the peak is detected. h is generally set at 1 <= h <= 3. According to Palshikar (2009), the default value was set to 1.5.

gaRunCnt

GA Execution Count (Default : 100)

gaGenerations

the maximum number of iterations to run before the GA search is halted. (Default : 500)

gaPopulation

the population size. (Default : 200)

gaElitism

the number of best fitness individuals to survive at each generation.(Default : 0.5)

gaMutation

the probability of mutation in a parent chromosome.Usually mutation occurs with a small probability, and by default is set to 0.1.

gaCrossover

the probability of crossover between pairs of chromosomes. Typically this is a large value and by default is set to 0.8.

Value

LogPrice : Log price of input time series data

id_SRTPT : Starting index of the data used for LPPL estimation as the lowest point after the previous crash time

id_crash : Index of real crash time

id_END : Last index of data used for crash time estimation

DT_SRTPT : Date corresponding to id_SRTPT

DT_crash : Date of real crash time

DT_END : Last date of data used for crash time estimation

Best_order : crash time estimation result (RMSE-based sorting data)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(lppl)

tradedate <- lppl::NASDAQ$Date
price <- lppl::NASDAQ$Close

Result <- lppl.validates(tradedate =tradedate
                       ,price = price
                       ,mb=c(1)
                       ,MovingWindows=c(5)
                       ,gaRunCnt=100
                       ,gaGenerations=200
                       ,gaPopulation=50)

mcgyver3/lppl documentation built on Jan. 1, 2021, 9:23 a.m.