| / Home |
| S-Archive | Download Script |
| neldmead | Nelder-Mead Simplex Algorithm |
| fobj | real-valued function. | |
| startvec | numeric vector of length 2 or greater. Initial value for the first argument of fobj. |
| print.level | Desired level of output during the iteration. Print.level = 0 for quiet running, = 1 for function value at each iteration, = 2 to prompt for continuation after each iteration. | |
| tol | Desired accuracy. | |
| ... | Additional arguments to be passed to fobj. |
| x | numeric vector. Argument of fobj at the local minima. | |
| fmin | value of fobj at the local minima. | |
| iter | number of iterations used. |
# Find a least trimmed SS (LTS) regression estimator
# neldmead is more accurate but slower than the built-in
# S-Plus function ltsreg
> x <- 1:20
> y <- x + rnorm(20)
> lts <- function(ab, x, y)
{
e <- y - ab[1] - ab[2] * x
trim <- floor(length(y)/2) + floor(length(ab)/2)
mean(sort(e^2)[1:trim])
}
> neldmead(lts,c(0,0),x=x,y=y)
$x:
[1] -0.09447435 1.00664786
$fmin:
[1] 0.04699288
$iter:
[1] 50
| S-Archive | Download Script |
Gordon Smyth. Copyright © 1996-2016. Last modified: 10 February 2004