You don't appear to be supplying a valid parameter set to optim. The first argument in optim (par) must be a vector of parameters to optimise; you're passing a vector of NAs. Thise are not finite.
Also, temp is defined as a value and optim will not be able to optimise that. You need to define temp as a function. S ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}} ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.