找回密码
 注册
查看: 6612|回复: 0

R语言:optimize()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 17:27:34 | 显示全部楼层 |阅读模式
optimize(stats)
optimize()所属R语言包:stats

                                        One Dimensional Optimization
                                         一维优化

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

The function optimize searches the interval from lower to upper for a minimum or maximum of the function f with respect to its first argument.
功能optimize搜索间隔lowerupper最低或最高的功能f尊重其第一个参数。

optimise is an alias for optimize.
optimise是optimize别名。


用法----------Usage----------


optimize(f = , interval = ,  ..., lower = min(interval),
         upper = max(interval), maximum = FALSE,
         tol = .Machine$double.eps^0.25)
optimise(f = , interval = ,  ..., lower = min(interval),
         upper = max(interval), maximum = FALSE,
         tol = .Machine$double.eps^0.25)



参数----------Arguments----------

参数:f
the function to be optimized. The function is either minimized or maximized over its first argument depending on the value of maximum.
函数进行优化。该功能可以最小化或最大化,取决于maximum值超过其第一参数。


参数:interval
a vector containing the end-points of the interval to be searched for the minimum.
一个向量包含要搜索的最低间隔终点。


参数:...
additional named or unnamed arguments to be passed to f.
额外的命名或无名的参数被传递到f。


参数:lower
the lower end point of the interval to be searched.
低端点的间隔被搜查。


参数:upper
the upper end point of the interval to be searched.
要搜索的高端点的间隔。


参数:maximum
logical.  Should we maximize or minimize (the default)?
逻辑。我们应该最大化或最小化(默认)?


参数:tol
the desired accuracy.
所需的精度。


Details

详情----------Details----------

Note that arguments after ... must be matched exactly.
请注意,后...参数必须完全匹配。

The method used is a combination of golden section search and successive parabolic interpolation, and was designed for use with continuous functions.  Convergence is never much slower than that for a Fibonacci search.  If f has a continuous second derivative which is positive at the minimum (which is not at lower or upper), then convergence is superlinear, and usually of the order of about 1.324.
所采用的方法是一个黄金分割搜索和连续的抛物线插值结合,为连续函数的使用而设计的。收敛是从来没有比这慢的斐波纳契搜索。 f如果有连续的二阶导数,这是最低的阳性(这是不是在lower或upper),然后融合是超,通常约1.324秩序。

The function f is never evaluated at two points closer together than eps * |x_0| + (tol/3), where eps is approximately sqrt(.Machine$double.eps) and x_0 is the final abscissa optimize()$minimum.<br> If f is a unimodal function and the computed values of f are always unimodal when separated by at least eps *  |x| + (tol/3), then x_0 approximates the abscissa of the global minimum of f on the interval lower,upper with an error less than eps * |x_0|+ tol.<br> If f is not unimodal, then optimize() may approximate a local, but perhaps non-global, minimum to the same accuracy.
功能f永远不会计算在两点紧密联系起来比eps *   |x_0| + (tol/3)eps约sqrt(.Machine$double.eps)和x_0是最后的横坐标如果optimize()$minimum是一个单峰函数和计算值f总是单峰时,至少feps *分开,然后 |x| + (tol/3)参考。 x_0接近全球最低f在区间lower,upper错误少于eps *   |x_0|+ tol参考。如果f横坐标不是单式,然后optimize()5月近似的地方,但也许非全局,以相同的精度最低。

The first evaluation of f is always at x_1 = a + (1-&phi;)(b-a) where (a,b) = (lower, upper) and phi = (sqrt(5) - 1)/2 = 0.61803.. is the golden section ratio. Almost always, the second evaluation is at x_2 = a + phi(b-a). Note that a local minimum inside [x_1,x_2] will be found as solution, even when f is constant in there, see the last example.
f评价始终是在x_1 = a + (1-&phi;)(b-a)(a,b) = (lower, upper)和phi = (sqrt(5) - 1)/2 = 0.61803..是黄金分割比例。几乎总是,第二次评估是在x_2 = a + phi(b-a)。请注意,里面[x_1,x_2]当地最低将发现解决方案,即使f是固定在那里,看到的最后一个例子。

f will be called as f(<VAR>x</VAR>, ...) for a numeric value of <VAR>x</VAR>.
ff(<VAR>x</VAR>, ...)的<VAR>的数值将被称为X </变更>。


值----------Value----------

A list with components minimum (or maximum) and objective which give the location of the minimum (or maximum) and the value of the function at that point.
与组件列表minimum(maximum)objective给最低的位置(或最大),并在该点的函数值。


源----------Source----------

A C translation of Fortran code http://www.netlib.org/fmm/fmin.f based on the Algol 60 procedure localmin given in the reference.
Fortran代码http://www.netlib.org/fmm/fmin.f交流基础上的Algol 60程序翻译localmin参考。


参考文献----------References----------

Algorithms for Minimization without Derivatives. Englewood Cliffs N.J.: Prentice-Hall.

参见----------See Also----------

nlm, uniroot.
nlm,uniroot。


举例----------Examples----------


require(graphics)

f <- function (x,a) (x-a)^2
xmin <- optimize(f, c(0, 1), tol = 0.0001, a = 1/3)
xmin

## See where the function is evaluated:[#见的功能进行评估:]
optimize(function(x) x^2*(print(x)-1), lower=0, upper=10)

## "wrong" solution with unlucky interval and piecewise constant f():[#“错误”的解决方案,倒霉的间隔和分段常数F():]
f  <- function(x) ifelse(x > -1, ifelse(x < 4, exp(-1/abs(x - 1)), 10), 10)
fp <- function(x) { print(x); f(x) }

plot(f, -2,5, ylim = 0:1, col = 2)
optimize(fp, c(-4, 20))# doesn't see the minimum[没有看到的最低]
optimize(fp, c(-7, 20))# ok[确定]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-23 01:03 , Processed in 0.025087 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表