Hello!

 

I am getting the following errors when running optim() [I tried optim() with
3 different methods as you can see]:

 

Error in optim(c(0.66, 0.999, 0.064), pe, NULL, method = "L-BFGS-B") : 

  objective function in optim evaluates to length 6 not 1

> out <- optim( c(0.66, 0.999, 0.064), pe, NULL, method = "Nelder-Mead")

Error in optim(c(0.66, 0.999, 0.064), pe, NULL, method = "Nelder-Mead") : 

  objective function in optim evaluates to length 6 not 1

> out <- optim( c(0.66, 0.999, 0.064), pe, NULL, method = "CG")

Error in optim(c(0.66, 0.999, 0.064), pe, NULL, method = "CG") : 

  objective function in optim evaluates to length 6 not 1

 

I don't know what the error message should mean to me.

Particulars for the problem are listed below.

Thanks in advance for any help!!

 

Stu

 

 

> y <-
c(0.111111111111111,0.0921052631578947,0.0564516129032258,0.0608108108108108
,0.0128205128205128,0.0136078431372549)

> x3 <- c(3600,169200,185400,255600,271800,342000)

> x2 <- c(1,3,4,5,6,7)

> x1 <-
c(0,0.978723404255319,0.087378640776699,0.549295774647887,0.0596026490066225
,0.61578947368421)

> observs <- data.frame(y, x1, x2, x3)

> attach(observs)

> pe <- function(c) c[1]*x1*x2^c[2]*x3^c[3]

> out <- optim(c(0.66, 0.999, 0.064), pe, NULL, method = "L-BFGS-B")


	[[alternative HTML version deleted]]


