On 03/10/2009 5:26 PM, Jim Silverton wrote:
I have having the following error message when trying to optimize a function
using optim:



optim(c(10,100),fn,method="BFGS")
Error in optim(c(10, 100), fn, method = "BFGS") :
  cannot coerce type 'S4' to vector of type 'double'

Can someone tell me what this means?

I'd guess your fn doesn't return a numeric vector, it returns an object of type 'S4'. To be more specific, we'd need to see some code to reproduce the error message.

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to