[Rd] suggested modification to the 'mle' documentation?

Ben Bolker bolker at ufl.edu
Fri Dec 7 23:09:57 CET 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Luke Tierney wrote:
> On Fri, 7 Dec 2007, Duncan Murdoch wrote:
> 
>
> 
> For working at the general likelihood I think is is better to
> encourage the approach of definign likelihood constructor functions.
> The problem with using f, data is that you need to mathc the names
> used in f and in data, so either you have to explicitly write out f
> with the names you have in data or you have to modify data to use the
> names f likes -- in the running example think
> 
>     f <- function(lambda) -sum(dpois(x, lambda, log=T))
>     d <- data.frame(y=rpois(10000, 12.34))
> 
> somebody has to connext up the x in f with the y in d. With a negative
> log likelihood constructor defines, for example, as
> 
>     makePoisonNegLogLikelihood <- function(x)
>         function(lambda) -sum(dpois(x, lambda, log=T))
> 
> this happens naturally with
> 
>     makePoisonNegLogLikelihood(d$y)
> 
> 

  I hate to sound like a jerk, but I do hope that in the end we come
up with a solution that will still be accessible to people who don't
quite have the concept of writing functions to produce functions.  I
feel it is "natural" for people who have multiple data sets to have the
variables named similarly in different data sets.  All of the
constructor stuff is still accessible to anyone who wants to use the
function that way ... is there any way to do a cheesy default
constructor that is just equivalent to taking the likelihood function
and arranging for it to be evaluated in an environment containing
the data?  That way if "nllmaker" below were just a formula
or a log-likelihood function it could still work ...

  [snip]
> Both (simple) bootstrapping and (simple leave-one-out) crossvalidation
> require a data structure with a notion of cases, which is much more
> restrictive than the conext in which mle can be used.  A more ngeneric
> aproach to bootstrapping that might fit closer to the level of
> generality of mle might be parameterized in terms of a negative log
> likelihood constructor, a starting value constructor, and a resampling
> function, with a single iteration implemented soemthing like
> 
>     mleboot1 <- function(nllmaker, start, esample)  {
>     newdata <- resample()
>     newstart <- do.call(start, newdata)
>     nllfun <- do.call(nllmaker, newdata)
>     mle(fnllfun, start = newstart)
>     }
> 
> This would leave decisions on the resampling method and data structure
> up to the user. Somehing similar could be done with K-fold CV.
> 
> luke
> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHWcS1c5UpGjwzenMRAig2AJ9iTzhI1p8tBb7Q15jgT4nA+Zds+gCgggc2
sI2que28Hl1M5cVGa+anEL0=
=hCiS
-----END PGP SIGNATURE-----



More information about the R-devel mailing list