 Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: moptimize routine that works with quantile regression?

 From Tatyana Deryugina To statalist@hsphsun2.harvard.edu Subject st: moptimize routine that works with quantile regression? Date Mon, 17 Jan 2011 11:48:31 -0600

```Hi everyone,

I'm trying to program a quantile regression algorithm in mata, using
the moptimize() routine. However, I'm having trouble finding an
Frisch-Newton optimization method is fast and appropriate for quantile
regression - are there any Mata routines (within moptimize or
otherwise) that implement this?
Here's the way I'm constructing the objective function (or the vector
that moptimize will sum):

for (i=1; i<=rows(y); i++) {
if (y[i,1]-p[i,1] > 0) {
mult[i,1] = `quart'
}
else {
mult[i,1] = 1-`quart'
}
}
lnf = mult:*abs(y:-p)
}

y is the dependent variable, p is Xb, lnf is the "likelihood" vector,
and `quart' is the quartile. I tell moptimize to minimize this
"likelihood".
I've tried the "lf" and "gf0" evaluators and pretty much all the
optimization techniques. In some cases (when there are few independent
variables), I get the right answer, but for 4 dependent variables, the
routine doesn't work.
The reason I'm not using Stata's built-in command is because I
ultimately want to bootstrap the standard errors as well as use
weights. I've also found qreg and bsqreg to be very slow in my case
(lots of observations and dependent variables).