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

Johannes Lips johannes.lips at gmail.com
Tue Jul 14 09:51:53 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.
I've implemented the use of lm.fit() instead of lm in a first function 
call, where I only need the residuals of the OLS.
In all other instances it is a bit harder to replace, because I need the 
t-statistics and those are not as easily accessible from lm.fit() as 
from lm.
I need to check if the lm.fit() call really is equivalent to the lm 
call, because I think the results slightly changed, but the time gain 
was already considerable. It went from 3.6h to 2h on nearly 3000 
observations, just by replacing the lm with lm.fit() in two places.
Thanks again,
>> 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.

More information about the R-SIG-Finance mailing list