Greetings, Before I reinvent the wheel has anyone done a profile function for a fit using optim (or nlm)? (like the buggy profile.ms in S+) . It seems a bit tricky as the function to be minimised has to have arguments corresponding to the variables being fitted - which is one less than the function provided to optim()... I guess you can create another function on the fly somehow. Cheers, Steve. Dr Steve Roberts steve.roberts at man.ac.uk Biostatistics Group, School of Epidemiology and Health Sciences, 2nd Floor,Stopford Building, University of Manchester. M13 9PT. Tel: 0161 275 5192 FAX: 0161 275 5205
Ah, you mean a method for profile() for an object fitted by optim or nlm! That's not any of the first five or so meanings I envisaged. (Not that that can be exactly true, as the results from ms, optim and nlm are not classed.) It's not at all difficult to cook one up: you just need to look at the way arima uses optim with a variable subset of parameters held fixed. Unlike S-PLUS, you can use lexical scoping (and arima does). However, I would rather profile a real fit class using a fit function based on optim. On Thu, 23 Jan 2003, Steve Roberts wrote:> Greetings, > > Before I reinvent the wheel has anyone done a profile function for a > fit using optim (or nlm)? (like the buggy profile.ms in S+) . It > seems a bit tricky as the function to be minimised has to have > arguments corresponding to the variables being fitted - which is one > less than the function provided to optim()... I guess you can create > another function on the fly somehow. > > Cheers, > > Steve. > Dr Steve Roberts > steve.roberts at man.ac.uk > > Biostatistics Group, > School of Epidemiology and Health Sciences, > 2nd Floor,Stopford Building, > University of Manchester. > M13 9PT. > Tel: 0161 275 5192 FAX: 0161 275 5205 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/r-help >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
I have some code to do this; I keep meaning to clean it up and put it on CRAN, but it's fairly hard work to do it right. I also thought I heard a rumor that there would be something like that in MASS4. There should be a version on http://www.zoo.ufl.edu/bolker/R (subdirectories src and windows), let me know how it goes for you ... Ben On Thu, 23 Jan 2003, Steve Roberts wrote:> Greetings, > > Before I reinvent the wheel has anyone done a profile function for a > fit using optim (or nlm)? (like the buggy profile.ms in S+) . It > seems a bit tricky as the function to be minimised has to have > arguments corresponding to the variables being fitted - which is one > less than the function provided to optim()... I guess you can create > another function on the fly somehow. > > Cheers, > > Steve. > Dr Steve Roberts > steve.roberts at man.ac.uk > > Biostatistics Group, > School of Epidemiology and Health Sciences, > 2nd Floor,Stopford Building, > University of Manchester. > M13 9PT. > Tel: 0161 275 5192 FAX: 0161 275 5205 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/r-help >-- 318 Carr Hall bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704