[R] Excel can do what R can't?????

M.Kondrin mkondrin at hppi.troitsk.ru
Wed Jul 16 20:21:12 CEST 2003


optim(par, fn, gr = NULL,
            method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN"),
            lower = -Inf, upper = Inf,
            control = list(), hessian = FALSE, ...)

       fn: A function to be minimized (or maximized), with first
           argument the vector of parameters over which minimization is
           to take place. It should return a scalar result.

Your fn defined as:
f <- 1000000000*(((((Wt-Wtmod)^2)/Wt) + (((Hgt-Hgtmod)^2)/Hgt))2) ; f
What is its first argument I wonder?
I think you have just an ill-defined R function (although for Excel it 
may be OK - do not know) and optim just chokes on it.

More information about the R-help mailing list