There is an error in your call to `optim'. The`lower' bound is incorrect: lower=c(rep(-1,n),1e-5,1e-5,1e5)
This should be: lower=c(rep(-1,n),1e-5,1e-5,1e-5) I am not sure if this fixes the problem, but it is worth a try. I do not understand your scaling. From the lower and upper bounds it seems like (n+2)th parameter is the only one that needs to be scaled by a scale factor of 100. After you have fixed the error in `lower' and the scaling, you might also want to try "optimx" package that runs a bunch of optimization algorithms. Ravi. ------------------------------------------------------- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu<mailto:rvarad...@jhmi.edu> [[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.