[R-SIG-Finance] Implementation of Lee Strazicich Unit Root Test for R - Optimization

Johannes Lips johannes.lips at gmail.com
Mon Jul 13 07:58:26 CEST 2015

On 11.07.2015 17:35, Joshua Ulrich wrote:
> On Fri, Jul 10, 2015 at 5:01 AM, Johannes Lips <johannes.lips at gmail.com> wrote:
>> Dear list,
>> I have implemented the test from Lee and Strazichich (2003, 2004) in R and
>> uploaded it to github. [1]
>> The advantage of this test is, that it endogenously determines the dates of
>> up to two possible structural breaks and
>> it includes these structural breaks under the null and also the alternative
>> hypothesis.
>> I also implemented a General-to-Specific Approach to determine the number of
>> lagged augmented terms to include in the test equation.
>> At the moment it's not very efficient in regard to computing time, so I
>> would be glad if someone could point out improvements to make the code
>> faster and more efficient.
> If you provide an example I can run, I can profile it to look for
> bottlenecks.  From a quick look at the code, one thing that should
> help a fair amount is to avoid calls to lm() and call lm.fit()
> directly.
Thanks for your reply. For preliminary testing I often used a generated 
time series, which only has a break in the intercept at t=75.
After reading the csv file the test can be applied to the time series.
y <- read.csv("y.csv", col.names= c("t","y"))[,2]
ur.ls(y=y , model = "crash", breaks = 1, lags = NULL, method = "GTOS",pi 
= 0.1 )
The test call only looks for one break, but uses the general-to-specific 
approach, which is also quite time-consuming.
I will look into lm.fit() today and will try to implement it.

Thanks a lot for your suggestion!

>> Thanks in advance!
>> Best regards,
>> Johannes Lips
>> [1] https://github.com/hannes101/LeeStrazicichUnitRoot
>> Lee, Junsoo and Mark C. Strazicich (2003). “Minimum Lagrange Multiplier Unit
>> Root Test with Two Structural Breaks”. In: The Review of Economics and
>> Statistics 85.4, pp. 1082–1089.
>> Lee, Junsoo and Mark C. Strazicich (2004). “Minimum LM Unit Root Test with
>> One Structural Break”. In: 04-17. url:
>> https://ideas.repec.org/p/apl/wpaper/04-17.html (visited on 02/04/2015).
>> _______________________________________________
>> R-SIG-Finance at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions
>> should go.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: y.csv
Type: application/vnd.ms-excel
Size: 3483 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20150713/b00a6e2b/attachment.xlb>

More information about the R-SIG-Finance mailing list