[R-SIG-Finance] LPPL model for bubble burst forcasting
Wind
windspeedo99 at gmail.com
Fri Jul 17 13:05:03 CEST 2009
It works exactly as the chart.
Thanks Gabor
On Fri, Jul 17, 2009 at 6:58 PM, Gabor
Grothendieck<ggrothendieck at gmail.com> wrote:
> Try this:
>
> lines(exp(fitted(lm(log(pr) ~ ti))), col = "purple")
>
>
> On Fri, Jul 17, 2009 at 4:11 AM, Wind<windspeedo99 at gmail.com> wrote:
>> Sorry that I forgot including the first line of the code:
>> library(quantmod)
>>
>> So the replicable codes as following:
>>
>> library(quantmod)
>> hsi<-read.csv("http://32xiang.appspot.com/static/hsi-1970.csv",header=TRUE,stringsAsFactors=FALSE)
>> pr<-hsi$close
>>
>> plot(pr,type="l",log="y")
>> grid()
>>
>> ti<-index(pr)
>> ti2<-index(pr)^2
>>
>> lines(lm(pr~ti+ti2)$fit,col="red")
>> lines(lm(pr~ti)$fit,col="blue")
>> lines(lm(pr~ti2)$fit,col="pink")
>>
>>
>>
>>
>> On Fri, Jul 17, 2009 at 3:12 PM, Wind<windspeedo99 at gmail.com> wrote:
>>> There is a chart of Heng Seng index in page 24 of Prof. Sornette's paper:
>>> ## Financial Bubbles, Real Estate bubbles, Derivative Bubbles, and the
>>> Financial and Economic Crisis
>>> ## http://arxiv.org/abs/0905.0220
>>> The picture has also been attached as .hong kong.jpg
>>>
>>> The y axis of the chart is log-axis. And there is a straight line in
>>> the chart. "This is indeed the long-term behavior of this market, as
>>> shown by the best linear fit represented by the solid straight line,
>>> corresponding to an average constant growth rate of 13.8% per year."
>>> The following codes could not plot the same straight line. I wonder
>>> how could plot the straight best fit line in the log plot.
>>>
>>>
>>> ## Financial Bubbles, Real Estate bubbles, Derivative Bubbles, and the
>>> Financial and Economic Crisis
>>> ## http://arxiv.org/abs/0905.0220
>>> ## chart in Page 24
>>>
>>> hsi<-read.csv("http://32xiang.appspot.com/static/hsi-1970.csv",header=TRUE,stringsAsFactors=FALSE)
>>> pr<-hsi$close
>>>
>>> plot(pr,type="l",log="y")
>>> grid()
>>>
>>> ti<-index(pr)
>>> ti2<-index(pr)^2
>>>
>>> lines(lm(pr~ti+ti2)$fit,col="red")
>>> lines(lm(pr~ti)$fit,col="blue")
>>> lines(lm(pr~ti2)$fit,col="pink")
>>>
>>> Thanks in advance.
>>>
>>> wind
>>>
>>
>> _______________________________________________
>> R-SIG-Finance at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only.
>> -- If you want to post, subscribe first.
>>
>
More information about the R-SIG-Finance
mailing list