From ripley at stats.ox.ac.uk  Tue May 15 08:50:08 2007
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 15 May 2007 07:50:08 +0100 (BST)
Subject: [Rd] optim bug (PR#9684)
In-Reply-To: <20070514181124.4D9602A36F@slim.kubism.ku.dk>
References: <20070514181124.4D9602A36F@slim.kubism.ku.dk>
Message-ID: <Pine.LNX.4.64.0705150748380.12894@auk.stats>

This is not a bug, but as documented on the help page:

      ...: Further arguments to be passed to 'fn' and 'gr'. Beware of
           partial matching to earlier arguments.

You have partial matching to 'upper'.


On Mon, 14 May 2007, christina.merz at gmx.de wrote:

> Full_Name: Christina Merz
> Version: R version 2.5.0 (2007-04-23)
> OS: mingw32
> Submission from: (NULL) (213.70.209.132)
>
>
>
> R> version
>               _
> platform       i386-pc-mingw32
> arch           i386
> os             mingw32
> system         i386, mingw32
> status
> major          2
> minor          5.0
> year           2007
> month          04
> day            23
> svn rev        41293
> language       R
> version.string R version 2.5.0 (2007-04-23)
>
> -----------------------------------------------------------------------------
>
> R> sessionInfo()
> R version 2.5.0 (2007-04-23)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252
>
> attached base packages:
> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"
> [7] "base"
>
> -------------------------------------------------------------------------------
>
> 'optim' does not accept arguments called 'u'. Here is an example:
>
> R> fun<-function(x,u) (x-u)^2
> R> optim(7,fn=fun,u=9)
>
> Fehler in fn(par, ...) : Argument "u" fehlt (ohne Standardwert)
> Zus?tzlich: Warning message:
> bounds can only be used with method L-BFGS-B in: optim(7, fn = fun, u = 9)
>
> while
>
> R> fun<-function(x,y) (x-y)^2
> R> optim(7,fn=fun,y=9)
> $par
> [1] 8.999854
>
> $value
> [1] 2.145767e-08
>
> $counts
> function gradient
>      28       NA
>
> $convergence
> [1] 0
>
> $message
> NULL
>
> Warning message:
> one-diml optimization by Nelder-Mead is unreliable: use optimize in: optim(7, fn
> = fun, y = 9)
>
>
> -Christina
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


[Rd] optim bug (PR#9684)
Prof Brian Ripley