[R] Is profile.mle flexible enough?

Ben Bolker bbolker at gmail.com
Sun Aug 1 16:43:03 CEST 2010


Peter Dalgaard <pdalgd <at> gmail.com> writes:

> Issue #2 is stickier. I think I must say that the idelology of mle() is
> that the user passes a likelihood function. If the likelihood function
> depends on global data, and the user changes the global data, the user
> deserves what he or she gets... It is pretty much impossible for mle()
> to take an arbitrary function and detect which data it might depend on.
> 
> You can go the bbmle route and pass in the data set as a data frame, but
> then you lose the flexibility that a likelihood can depend on data that
> doesn't fit within the single rectangular data frame. 

  For the record, bbmle doesn't require 'data' to be a data frame --
it can be any list of objects (most typically a data frame but
not necessarily).
   I agree that one can accomplish all this with environments -- it's
a matter of taste/style/what one thinks will be easier and more consistent
in the long run for typical users.

  Ben



More information about the R-help mailing list