Fitting the Johansen-Ledoit-Sornette Model to Market Data
Summary
The document presents a question about fitting the Johansen-Ledoit-Sornette (JLS), or log-periodic power law, model to Malaysian stock-index data to estimate a possible crash time. It provides an R workflow that retrieves daily closing prices, defines the oscillatory power-law curve, and fits its parameters with nonlinear least squares. The reported fit converges, with a residual standard error of 75.75, but the parameter estimates have very large standard errors and near-zero t statistics, indicating substantial uncertainty in the fitted parameters.
The author asks whether different initial values or a different data window could reduce the residual error. The document does not answer that question or compare alternative windows, fitting constraints, or validation methods, so it offers an example of an estimation problem rather than evidence that the model predicts crashes reliably. The results also do not establish that a lower residual error would imply better out-of-sample timing. Any interpretation should account for parameter instability and the limits of fitting a flexible nonlinear model to one historical sample.
Key ideas
- The JLS model represents prices with a power-law trend and oscillations whose frequency changes logarithmically near a candidate critical time.
- The example estimates the model parameters from historical daily index closes using nonlinear least squares.
- The fit converges, but the reported parameter standard errors are large relative to their estimates.
- The document raises data-window and initialization choices as concerns but provides no tested solution.
- A low residual error alone would not establish reliable crash-time prediction.
Tags
Full text
# Johansen-Ledoit-Sornette Model
# Johansen-Ledoit-Sornette Model
im trying to predict crash time by using lppl model(JLS). My codes can run, but the error is to high....I try with some other initial values, but still can't reduce the error.....How i can reduce Standard Residual Error???or i need to change my data window????
```
library(tseries)
library(zoo)
ts <- get.hist.quote(instrument="^KLSE", start="1992-01-01", end="1997-01-01",
quote="Close", provider="yahoo", origin="1970-01-01",
compression="d", retclass="zoo")
df <- data.frame(ts)
df <- data.frame(Date=as.Date(rownames(df)),Y=df$Close)
df <- df[!is.na(df$Y),]
library(minpack.lm)
df$days <- as.numeric(df$Date-df[1,]$Date)\
f <- function(pars, xx){pars$a+pars$b*(pars$tc-xx)^pars$m* (1+pars$c*cos(pars$omega*log(pars$tc-xx)+pars$phi))}
resids <- function(p,observed,xx){df$Y-f(p,xx)}
nls.out<-nls.lm(par=list(a=300, b=-400, tc=1308, m=0.5, omega=19.5, phi=-30, c=-14), fn=resids, observed=df$Y, xx=df$days, control=nls.lm.control(maxiter=1024, ftol=1e-6, maxfev=1e6))
par <- nls.out$par
nls.final<-nls(Y~a+(tc-days)^m*(b+c*cos(omega*log(tc-days)+phi)), data=df, start=par, algorithm="plinear", control=nls.control(maxiter=1024, minFactor=1e-8))
summary(nls.final)
```
Formula: `Y ~ a + (tc - days)^m * (b + c * cos(omega * log(tc - days) + phi))`
```
Parameters:
Estimate Std. Error t value Pr(>|t|)
a 1.138e+04 1.929e+08 0.000 1.000
b -1.071e+04 1.816e+08 0.000 1.000
tc 1.331e+03 9.911e+02 1.343 0.180
m 3.032e-03 1.888e+00 0.002 0.999
omega 2.399e+01 1.985e+03 0.012 0.990
phi -5.955e+01 1.298e+04 -0.005 0.996
c 1.715e-03 2.915e+01 0.000 1.000
.lin 2.351e+00 3.982e+04 0.000 1.000
Residual standard error: 75.75 on 752 degrees of freedom
Number of iterations to convergence: 55
Achieved convergence tolerance: 3.632e-06
```Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.