2017-10-31 2 views
1

stats::nlminb()의 경우 lowerupper 경계가 있습니까? 나는 도움말 페이지 및 예제를 읽고 모든 I이었다 발견nlminb의 경계는 엄격하거나 포함됩니다

lower, upper: vectors of lower and upper bounds, replicated to be as long as start. 
       If unspecified, all parameters are assumed to be unconstrained. 

와 예 :

내가 0이 될 수 없습니다 매개 변수를 가지고 있기 때문에 알 필요가
## 25-dimensional box constrained 
## par[24] is *not* at boundary 
nlminb(rep(3, 25), flb, lower = rep(2, 25), upper = rep(4, 25)) 
## trying to use a too small tolerance: 
r <- nlminb(rep(3, 25), flb, control = list(rel.tol = 1e-16)) 
stopifnot(grepl("rel.tol", r$message)) 

- 그게 할 수있다 범위는 (0, Inf)[0, Inf)입니다.

+2

인 클루 시브, 항상 (개념에 의한) 수치 최적화에서와 같이. 0이 아닌 것은> = 엡실론 (엡실론을 조정하기가 어렵습니다)과 같이 어색한 것을 필요로합니다. (그리고 나는 동시에 묻고 대답하는 것에 대해 어떻게 생각해야할지 모르겠다.) – sascha

+0

[ "맑은 마음으로, 자신의 질문에 대답하고 대답하는 것만으로도 분명히 권장된다." ] (https://stackoverflow.blog/2011/07/01/its-ok-to-ask-and-answer-your-own-questions/) – swihart

답변

0

저는이 예제를 보았습니다. 하단 예제 lower을 -1로 설정하고 반환되는 값은 $par입니다. 1 상한 upper 세트하고 리턴되는 값이다 $par 마찬가지로

> nlminb(start=-0.5,objective=dnorm, lower=-1, upper=0) 
$par 
[1] -1 

$objective 
[1] 0.2419707 

$convergence 
[1] 0 

$iterations 
[1] 3 

$evaluations 
function gradient 
     3  3 

$message 
[1] "X-convergence (3)" 

.

> nlminb(start=0.5,objective=dnorm, lower=0, upper=1) 
$par 
[1] 1 

$objective 
[1] 0.2419707 

$convergence 
[1] 0 

$iterations 
[1] 3 

$evaluations 
function gradient 
     3  3 

$message 
[1] "X-convergence (3)" 

당신이 필요로하는 경우 log()

> nlminb(start=0.5,objective=log, lower=0, upper=1) 
$par 
[1] 0 

$objective 
[1] -Inf 

$convergence 
[1] 0 

$iterations 
[1] 2 

$evaluations 
function gradient 
     2  3 

$message 
[1] "both X-convergence and relative convergence (5)" 

보고 될 수 있습니다 더 많은 설명을하여 $objective 유한 수를 수동으로 lower에 대한 퍼지 요인에 둘 필요가 있습니다

> nlminb(start=0.5,objective=log, lower=0+1e-50, upper=1) 
$par 
[1] 1e-50 

$objective 
[1] -115.1293 

$convergence 
[1] 0 

$iterations 
[1] 2 

$evaluations 
function gradient 
     2  2 

$message 
[1] "both X-convergence and relative convergence (5)"