Regrading your second question, I guess somehow you get undefined value like logarithm of zero of your target function for some unfortunate parameter values in the parameter space.
Devred, Emmanuel wrote: > > Hi everyone, > > I have two questions: > > I would like to get confidence intervals on the coefficients derived > from the optim() function. > I apply optim() to a given function f >> res <- > optim(c(0.08,0.04,1.),f,NULL,method="L-BFGS-B",lower=c(0.,0.,0.)) > And I would like to get the p-value and confidence intervals associated > with >> res$par > > My second question deals with error message. I am doing a loop with the > optim() function in it, when I get an error message like below, the loop > is stopped, however I would like to change my initial values to avoid > this error message and keep the loop going, so if it crashes when I am > away the program can still run, any idea ? > > Error in optim(c(0.08, 0.04, 1), f, NULL, method = "L-BFGS-B", lower = > c(0, : > L-BFGS-B needs finite values of 'fn' > > Thank you for any information on these two problems. > > Emmanuel > > ------------------------------------------- > Dr. Emmanuel Devred > Bedford Institute of Oceanography, > 1 Challenger Drive, > Dartmouth, Nova Scotia, B2Y 4A2, > Canada > > Ph: (1) 902 426-4681 > Fax: (1) 902 426-9388 > > devr...@mar.dfo-mpo.gc.ca > > http://myweb.dal.ca/edevred/ > ------------------------------------------- > > > > [[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. > > -- View this message in context: http://www.nabble.com/Confidence-interval-on-parameters-from-optim-function-tp25044388p25046772.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.