On Tue, Jul 17, 2012 at 2:00 AM, Christos Michalopoulos <mixalopoulo...@hotmail.com> wrote: > > > > > I am working on a two stage threshold quantile regression model in R, and my > aim is to estimate the threshold of the reduced-form equation (call it > rhohat), and the threshold of the structural equation (call it qhat), in two > stages. On the first stage, i estimate rhohat by quantile regression and > obtain the fitted values. I use these fitted values to estimate qhat on the > second stage. The code is as follows (thanks to Prof. Bruce Hansen, whose > code i modified):
<snip> > #************************************************************#You can easily > run it yourselves. The problem is that when i write, > stqr_thresh_loop(n=200,reps=500) the code crashes and never gives me any > result. I only get "the program has stopped responding". What am i doing > wrong? Thank you very much!! I don't get a crash, I get what I would call a 'hang' -- R never finishes working, and the operating system says it isn't responding to messages, but R doesn't disappear. This could be a bug or just a very slow piece of code, so the first step is to run a smaller example and time it. With a smaller number of reps, the code mostly works but sometimes hangs. On the Mac, you can use the Activity Monitor to sample the process, and it turns out to be stuck in a compiled-code routine called "rqbr", which looks like it's part of rq(), called from rq.fit.br() Since the problem seems to be data-dependent, and happens with fairly high frequency, you might want to use trace() to stick some sort of data summary in before the call to rqbr, to see if anything obvious is wrong with the data being passed in before things go wrong. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.