[R] Problem specifying "function" for "mle" operation

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Jul 27 11:34:24 CEST 2005


"Narcyz Ghinea" <Narcyz.Ghinea at swsahs.nsw.gov.au> writes:

> MY THEORY:
> 
> I think it has something to do with the fact that the function
> argument is a vector in CASE 2. Hope this doesn't mean I have to
> re-write the function in a way that it doesn't require vector
> inputs.....

You do. The innards of mle has

    f <- function(p) {
        l <- as.list(p)
        names(l) <- nm
        l[n] <- fixed
        do.call("minuslogl", l)
    }

which converts the parameters to a list before calling the likelihood.
 
> Any suggestions on how to make CASE 2 work would be appreciated.

Well, either you conform or you patch mle to handle functions with
vector parameters....

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list