SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: speed up maxlik routine [ Reply ]
By: Ott Toomet on 2016-02-12 01:41
[forum:42924]
You have to program the data generating process (DGP). Basically, simulate the expected distribution at given parameter values. If you can do it for OLS, you should also be able to do it for stochastic frontiers (although programming may be tedious).

I cannot tell much more unless I know more about your problem.
Ott

RE: speed up maxlik routine [ Reply ]
By: Ott Toomet on 2016-02-12 01:39
[forum:42923]
If you don't select a method then I guess you land on Newton-Raphson (NR), not Nelder-Mead (NM). You don't mention it explicitly but I suspect you don't have analytic gradients. Stochastic frontier analysis also suggests you are estimating mixture models with are often weakly identified (ie rather flat). On top of that, constraints add to the computation burden.

I suggest to use BHHH if possible (if the observations are independent). That would eliminate numeric hessian (thousands of likelihood calculations per iteration), it is also potentially more stable (BHHH approximation errors may be smaller than numeric Hessian computation errors).

You may also consider making your convergence criteria more relaxed.

Finally, if the model never converges, it basically tells you that there is too little information in the data to answer your question. You may want to fix certain parameters in this case.

RE: speed up maxlik routine [ Reply ]
By: Graziella Bonanno on 2016-02-11 22:13
[forum:42922]
I always obtain the results from Nelder Mead method (I forgot to write it in the previous reply).

I have another question: how can I do a Monte Carlo simulation about my topic?

Thank you very much.
Best,
Graziella

RE: speed up maxlik routine [ Reply ]
By: Graziella Bonanno on 2016-02-11 22:09
[forum:42921]
Dear Arne and Ott,
I do not select any method. This is the command:

maxLik(ll_prodfDS, start=ivDS, iterlim=1e5,reltol=1e-10, constraints=list(ineqA=A4,ineqB=B4))

As you can see, I have to consider some inequality constraints.
ll_prodfDS is a log-likelihood function in which there are some hypergeometric functions.

I am working on methodological (then empirical) developments of Stochastic Frontier models.

Best,
Graziella

RE: speed up maxlik routine [ Reply ]
By: Arne Henningsen on 2016-02-11 21:21
[forum:42920]
Dear Graziella

Do you use finite-difference or analytic derivatives (and Hessians)? As Ott wrote, using analytic derivatives (with BHHH or BFGS / BFGSR) or using both analytic derivatives and analytic Hessians (with maxNR) will probably considerably speed up the estimation.

Best,
Arne

RE: speed up maxlik routine [ Reply ]
By: Ott Toomet on 2016-02-11 20:55
[forum:42918]
What kind of model are you using? 1500 obs/40 param does not tell much unless we know what is the model (how does the likelihood look like). Note that if you are using Newton-Raphson with numerical derivatives, it also includes 80 function calculations for the gradient and (I guess) 3200 for the Hessian. You should consider BHHH or BFGS in that case.

How many iterations are you running already and which method do you use?

Cheers,
Ott

RE: speed up maxlik routine [ Reply ]
By: Graziella Bonanno on 2016-02-11 20:17
[forum:42917]
Dear Ott Toomet,
thank you very much for the answers.

My problem is that I have to estimate 40 parameters. Not only, I have 1500 observations....

1 day for 1 estimation.... :(

Thank you very much for answer to question 2. This information is very fruitful for me.

Best,
Graziella

RE: speed up maxlik routine [ Reply ]
By: Ott Toomet on 2016-02-11 20:12
[forum:42916]
Hey Graziella,

1) it depends. There is only a limited scope to boost the speed of the optimizer routines (such as maxNR) itself. But this is usually not what you need, typically optimizers spend most of their time calculating your likelihood function (and it's derivatives). In particular, analytic derivatives often give a huge speed boost.

Another typical problem is a flat maximum--the estimates jump back-and-forth on an essentially flat region of the likelihood but never settle to one final solution. This often means that either your data and model do not match well, or you have numeric issues. A solution may be to use sloppier convergence criteria (or revise your model ;-)

Feel free to tell us more what exactly is your problem.

2) yes, with an easy trick: run maxLik with iterlim=1 in a loop. If it ends with message "iteration limit exceeded" (code 100 AFAIR), so whatever you wish with the temporary results, and restart maxlik with updated start values.

speed up maxlik routine [ Reply ]
By: Graziella Bonanno on 2016-02-11 19:47
[forum:42915]
Dear All,
I have two questions:

1) I am estimating with maxlik package. Is there a way to speed up the routine?

2) Is there a way to store the estimation results while the routine is working? I mean whether it is possible to obtain the preliminary results before the end of optimization in order to store the results in a specific iteration.

Thanks in advance.
Best,
Graziella

Thanks to:
Vienna University of Economics and Business Powered By FusionForge