Hi all,
 
This is my first optimization code and am receiving the following error for the 
following function:
fn <- function(p) {

+263*log(sqrt(2*pi)*sd(test$A))+ sum(log(abs(c(test$A[-1], 1))^p[3])) + 
(sum(((test$A-p[1]+(p[2]+1)*c(test$A[-1], 
1)))^2)/sum(sd(test$A)*(abs(c(test$A[-1], 1))^p[3])^2))/2 

}

out <- optim(fn, p = c(0.1, 0.1, 2.5), method="BFGS", hessian=TRUE)

Error in optim(fn, p = c(0.1, 0.1, 2.5), method = "BFGS", hessian = TRUE) : 

non-finite finite-difference value [3]

 
Have tried multiple initial values however, the error remains tha same.
 
Running R 2.12.1
 
Many Thanks!

        [[alternative HTML version deleted]]

______________________________________________
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