A newbie question: I'm trying to decide whether to run a maximum likelihood estimation in R or Stata and am wondering if the R mle routine is reasonably robust. I'm fairly certain that, with this data, in Stata I would get a lot of complaints about non-concave functions and unproductive steps attempted, but would eventually have a successful ML estimate. I believe that, with the 'unproductive step' at least, Stata gets around the problem by switching to some alternative estimation method in difficult cases. Does anyone know how robust mle is in R? Thanks, Peter
R does not have one "mle routine". Many statistical procedures do maximum likelihood estimation (mle) either by default or as an option. The "robustness" would depend on the likelihood and what you want to do and what you mean by "robustness. Read the help files and check "www.r-project.org" -> search -> "R site search" for functions you might want to use. S (of which R is an implementation) is a object-oriented language for statistics. If you want to do standard analyses, Stata and other "statistical packages" may be easier to use. If you application(s) involve a substantial amount of custom scripting, I know of nothing that beats R. Many new statistical procedures are developed first in R and only later ported to other languages. I expect this to be even more true in the future than it is today. hope this helps. spencer graves Peter Muhlberger wrote:> A newbie question: I'm trying to decide whether to run a maximum likelihood > estimation in R or Stata and am wondering if the R mle routine is reasonably > robust. I'm fairly certain that, with this data, in Stata I would get a lot > of complaints about non-concave functions and unproductive steps attempted, > but would eventually have a successful ML estimate. I believe that, with > the 'unproductive step' at least, Stata gets around the problem by switching > to some alternative estimation method in difficult cases. Does anyone know > how robust mle is in R? > > Thanks, > Peter > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Peter, The R "optim" function is what you probably want to read up on for ML in R. It may or may not be less "complaining" than the Stata ML functions. Optim provides several alternative algorithms which may help you find one that is best for your problem. On the other hand, it sounds like you have a difficult likelihood and/or recalcitrant data. It seems likely that your likelihood and data are going to cause more problems than are due to any peculiarities of the algorithms in Stata OR R. No magic bullets in either, of course. For what it is worth, I've not managed to "break" the optim function in R. Comparatively, I think the Stata ML functions make access to the variables and specification of the model a little easier and require fewer lines of code. Stata also then provides standard post estimation commands for the ML results. R (optim, actually) will return an object with the usual components that you can also use for any post estimation purposes. But in R you'll probably write a few more lines of code to specify the model and manipulate the returned results. You probably need to learn a bit more to program this effectively in R than you need to learn to do the same thing in Stata. Also, Stata's "ml check" provides a nice test of your code before you loose it on the data! Gauss's "maxlik" routines would be another possibility, if you have or are able to acquire Gauss. Charles /****************************************** ** Charles H. Franklin ** Professor, Political Science ** University of Wisconsin, Madison ** 1050 Bascom Mall ** Madison, WI 53706 ** 608-263-2022 Office ** 608-265-2663 Fax ** mailto:franklin at polisci.wisc.edu (best) ** mailto:chfrankl at facstaff.wisc.edu (alt) ** http://www.polisci.wisc.edu/~franklin ******************************************/ -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Peter Muhlberger Sent: Sunday, July 13, 2003 9:55 AM To: rhelp Subject: [R] How robust is mle in R? A newbie question: I'm trying to decide whether to run a maximum likelihood estimation in R or Stata and am wondering if the R mle routine is reasonably robust. I'm fairly certain that, with this data, in Stata I would get a lot of complaints about non-concave functions and unproductive steps attempted, but would eventually have a successful ML estimate. I believe that, with the 'unproductive step' at least, Stata gets around the problem by switching to some alternative estimation method in difficult cases. Does anyone know how robust mle is in R? Thanks, Peter ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
There's no 'mle' routine in R. For doing general maximum likelihood estimation I often use 'optim' or 'nlm'. I find 'optim' to be very useful, although you have to become familiar with all of the options/arguments in order to use it successfully. For example, you often have to provide scaling information (via 'parscale') to 'optim' in order for a good solution to be found. If you have a very complicated likelihood surface, than finding a good solution will likely be the exception rather than the rule, and I think that's independent of what software you use. R's 'optim' function provides four different procedures for optimizing a function, each of which has its advantages and disadvantages. I suggest checking out the help page for 'optim', which is very detailed. -roger Peter Muhlberger wrote:>A newbie question: I'm trying to decide whether to run a maximum likelihood >estimation in R or Stata and am wondering if the R mle routine is reasonably >robust. I'm fairly certain that, with this data, in Stata I would get a lot >of complaints about non-concave functions and unproductive steps attempted, >but would eventually have a successful ML estimate. I believe that, with >the 'unproductive step' at least, Stata gets around the problem by switching >to some alternative estimation method in difficult cases. Does anyone know >how robust mle is in R? > >Thanks, >Peter > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > > >