Dave > Did you try supplying gradient information to nlminb? (I note that nlminb is used for the optimization, but I don't see any gradient information supplied to it.) I would suspect that supplying gradient information would greatly speed up the computation (as you note in comments at http://otter-rsch.ca/tresults.htm.)
Actually you should probably ask Norm Olsen these questions. I am not proficient in R and am just using his code. However I can say that providing derivatives for such a model is a highly nontrivial exercise. As I said in my posting, the R script and data are available to anyone who feels that the exercise was not carried out properly and would like to improve on it. Also one does not need to provide derivatives to the AD Model Builder program. Finally suppose that you are very good at calculating derivatives and manage to get them right. Then someone else comes along who wants to modify the model. Unless they are also very good at calculating derivatives there will be trouble. > > I'm curious -- when you say "R may not be a suitable platform for development for such models", what aspect of R do you feel is lacking? Is it the specific optimization routines available, or is it some other more general aspect? 2 seconds vs 90 minutes. For a real problem of tihs type the timings would probably be something like 10 minutes vs more than 2,700 minutes. > > Also, another optimization algorithm available in R is the "L-BFGS-B" method for optim() in the MASS package. I've had extremely good experiences with using this code in S-PLUS. It can take box constraints, and can use gradient information. It is my first choice for most optimization problems, and I believe it is very widely used. Did you try using that optimization routine with this problem? > > -- Tony Plate > > dave fournier wrote: >> There has recently been some discussion on the list about >> AD Model builder and the suitability of R for constructing the >> types of models used in fisheries management. >> >> https://stat.ethz.ch/pipermail/r-help/2006-January/086841.html >> >> https://stat.ethz.ch/pipermail/r-help/2006-January/086858.html >> >> I think that many R users understimate the numerical challenges >> that some of the typical nonlinear statistical model used in different >> fields present. R may not be a suitable platform for development for >> such models. >> >> Around 10 years ago John Schnute, Laura Richards, and Norm Olsen >> with Canadian federal fisheries undertook an investigation >> comparing various statistical modeling packages for a simple >> age-structured statistical model of the type commonly used in >> fisheries. They compared AD Mdel Builder, Gauss, Matlab, and >> Splus. Unfortunately a working model could not be produced with Splus >> so its times could not be included in the comparison. It is possible >> to produce a working model with the present day version of R so that >> R can now be directly compared with AD Model Builder for this type of model. >> >> I have put the results of the test together with the original >> Schnute and Richards paper and the working R and AD Model Builder >> codes on Otter's web site >> >> http://otter-rsch.ca/tresults.htm >> >> The results are that AD Model builder is roughly 1000 times faster than >> R for this problem. ADMB takes about 2 seconds to converge while >> R takes over 90 minutes. >> >> This is a simple toy example. Real fisheries models are often hundred of >> times more computationally intensive as this one. >> >> Cheers, >> >> Dave >> ~ > -- David A. Fournier P.O. Box 2040, Sidney, B.C. V8l 3S3 Canada Phone/FAX 250-655-3364 http://otter-rsch.com -- David A. Fournier P.O. Box 2040, Sidney, B.C. V8l 3S3 Canada Phone/FAX 250-655-3364 http://otter-rsch.com ______________________________________________ R-help@stat.math.ethz.ch 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.