s-news
[Top] [All Lists]

[S] Optimization problem

To: s-plus discussion <s-news@wubios.wustl.edu>
Subject: [S] Optimization problem
From: "José Ailton Alencar andrade" <andrade@inep.gov.br>
Date: Fri, 31 Jul 1998 18:02:27 -0300
Sender: owner-s-news@wubios.wustl.edu
    Dear S users,

     I am trying  to find the optimum of a function:

    I have the following function which I want to fine your minimum:

ob<-
function(alpha, beta)
{
 (-1 * (N * log(alpha) + (N * alpha - 1) * log(beta) - (alpha - 1) *
sum(log(beta + x))))/N
}

I have also the gradient and hessian matrix in the list:

grad <-
function(alpha, beta)
{
 list(gradient = c(-1/alpha - log(beta) + sum(log(beta + x))/N,  - (N *
alpha - 1)/(N * beta) + ((alpha
+
  1) * sum(1/(beta + x)))/N), hessian = c(1/(alpha^2), -1/beta +
sum(1/(beta - x))/N, (N * alpha
-
  1)/(N * beta^2) - ((alpha + 1) * sum(1/((beta + x)^2)))/N))
}

WHERE: 0<alpha<1
               0<beta<infinity
                M=52 and N=30 (both avaliable in working directory)
                x=c(49, 5, 17, 2, 39, 84, 7, 0, 35, 36, 1400, 5, 34, 15,
11, 2, 1, 39, 8, 101, 2, 148, 1, 68,
                     31, 1, 20, 118, 91, 427)   (avaliable in working
directory)

So, I put the command:

nlminb(st = c(0.4, 5), objective = ob, gradient = grad, hessian = T,  ,
N = N, M = M, x = x)


$parameters:
[1] 0.4 5.0

$objective:
[1] 0

$message:
NULL

$grad.norm:
[1] 0

$iterations:
[1] 0

$f.evals:
[1] 1

$g.evals:
[1] 1

$hessian:
     [,1] [,2]
[1,]    0    0
[2,]    0    0

$scale:
[1] 1 1

$aux:
$aux$N:
[1] 30

$aux$M:
[1] 52

$aux$x:
 [1]   49    5   17    2   39   84    7    0   35   36 1400    5   34
15   11    2    1   39    8  101    2
[22]  148    1   68   31    1   20  118   91  427


$call:
nlminb(start = c(0.4, 5), objective = ob, gradient = grad, hessian = T,
N = N, M = M, x = x)

Warning messages:
1: Condition has 2 elements: only the first used in: is.na(fx) ||
is.nan(fx)
2: singularity encountered in: nlminb.2(temp, p, liv, lv, lh, objective,
gradient, bounds)

    Do I making any error???

    Thanks!

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • [S] Optimization problem, Jos=E9?= Ailton Alencar andrade <=