|
Hi All I'm analysing growth rates using a gompertz (logistic) curve and am attempting to fit parameters for all of my study birds using nlsList. I've been looking for an option in nlsList to set min and max limits for parameter values during estimation, although I have failed to find any under 'control'. Other users seem to have reported that using control in the port algorithm (as in an nls fit) failed to work and it didn't work in my case either. Is there such a control for nlsList? I did fashion a selfStart function with a work-around loop in it. This subsetted the data by ID and performed separate nls fits with parameters constrained by the port algorithm. My objective was to use nlsList as an object for an nlme fit, so I was thinking of pasting together the details of the fits from my slefStart function into an object of class "nlsList" "lmList" but wasn't sure if this would work or was even appropriate. Thanks for your help Steve Dr. Steve Oswald Penn State Berks [[alternative HTML version deleted]] ______________________________________________ [hidden email] 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. |
|
Hi All I'm analysing growth rates using a gompertz (logistic) curve and am attempting to fit parameters for all of my study birds using nlsList. I've been looking for an option in nlsList to set min and max limits for parameter values during estimation, although I have failed to find any under 'control'. Other users seem to have reported that using control in the port algorithm (as in an nls fit) failed to work and it didn't work in my case either. Is there such a control for nlsList? I did fashion a selfStart function with a work-around loop in it. This subsetted the data by ID and performed separate nls fits with parameters constrained by the port algorithm. My objective was to use nlsList as an object for an nlme fit, so I was thinking of pasting together the details of the fits from my slefStart function into an object of class "nlsList" "lmList" but wasn't sure if this would work or was even appropriate. Thanks for your help Steve Dr. Steve Oswald Penn State Berks [[alternative HTML version deleted]] ______________________________________________ [hidden email] 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. |
If you want to constrain to positive parameters only, as in pharmacology, fitting the logs of the parameters might help. For more general constraints, check the examples in optim. Dieter Hi All I'm analysing growth rates using a gompertz (logistic) curve and am attempting to fit parameters for all of my study birds using nlsList. I've been looking for an option in nlsList to set min and max limits for parameter values during estimation, although I have failed to find any under 'control'. Other users seem to have reported that using control in the port algorithm (as in an nls fit) failed to work and it didn't work in my case either. Is there such a control for nlsList? I did fashion a selfStart function with a work-around loop in it. This subsetted the data by ID and performed separate nls fits with parameters constrained by the port algorithm. My objective was to use nlsList as an object for an nlme fit, so I was thinking of pasting together the details of the fits from my slefStart function into an object of class "nlsList" "lmList" but wasn't sure if this would work or was even appropriate. Thanks for your help Steve Dr. Steve Oswald Penn State Berks [[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. |
|
Thanks Dieter
That solved the issue. I had negative parameters but I customized a selfStart function which contained the following lines for the optimization of my five parameter function (entered in the vector 'value'): #function to optimize func1 <- function( value) { A = value[1] k = value[2] i = value[3] Rk = value[4] Ri = value[5] y1<-rep(0,length(xy$x)) # a vector to hold predictions of y to compare with observed y for(p in 1:length(xy$x)){ y1[p]<- A*exp((-1*exp(-k*(xy$x[p]-i)))-(exp(Rk*(xy$x[p]-Ri))))} #this is my nonlinear equation evl<-sum((xy$y-y1)^2) #sum of squares is function to minimize return(evl) } #optimization oppar<-optim(c(A,k,i,Rk,Ri),func1,method="L-BFGS-B", lower=c(A*.5,0.001,0,-2,Ri*0.01), upper=c(A*2,0.5,65,2,Ri*100),control=list(maxit=2000,parscale=c(1e4,1e-2,1e1,1e-3,1e1))) #save optimized parameters value<-(c(oppar$par)) I also had to increase the tolerance parameter in the control section of the nlsList call to permit convergence for all individuals. I was then able to assess the fit using a trellis plot to check that they were satisfactory. Steve Dr. Steve Oswald Penn State Berks On Wed, Mar 31, 2010 02:32 AM, Dieter Menne <[hidden email]> wrote: > Steve Oswald wrote: >> >> I'm analysing growth rates using a gompertz (logistic) curve and >am >> attempting >> to fit parameters for all of my study birds using nlsList. >> >> I've been looking for an option in nlsList to set min and max limits for >> parameter values during estimation, although I have failed to find any >> under >> 'control'. >> > >If you want to constrain to positive parameters only, as in pharmacology, >fitting the logs of the parameters might help. For more general constraints, >check the examples in optim. > >Dieter > > > > > >Hi All > > >I'm analysing growth rates using a gompertz (logistic) curve and am >attempting >to fit parameters for all of my study birds using nlsList. > > >I've been looking for an option in nlsList to set min and max limits for >parameter values during estimation, although I have failed to find any under >'control'. Other users seem to have reported that using control in the port >algorithm (as in an nls fit) failed to work and it didn't work in my >case >either. Is there such a control for nlsList? > > >I did fashion a selfStart function with a work-around loop in it. This >subsetted the data by ID and performed separate nls fits with parameters >constrained by the port algorithm. My objective was to use nlsList as an >object >for an nlme fit, so I was thinking of pasting together the details of the >fits >from my slefStart function into an object of class "nlsList" >"lmList" but >wasn't sure if this would work or was even appropriate. > > >Thanks for your help > > >Steve > > >Dr. Steve Oswald > > >Penn State Berks > > [[alternative HTML version deleted]] > >______________________________________________ >[hidden email] 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://n4.nabble.com/nlsList-nlme-control-of-min-and-max-parameter-bounds-tp1746242p1746347.html >Sent from the R help mailing list archive at Nabble.com. > >______________________________________________ >[hidden email] 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. > > > [[alternative HTML version deleted]] ______________________________________________ [hidden email] 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. |
|
.. and do not forget that the real power comes from using nlme
after nlsList; i.e. on the result of nlsList, even if some did not converge!
The effect of taming outliers can be amazing. See Pinheiro/Bates or http://www.menne-biomed.de/gastempt/index.html Dieter From: Steve
Oswald [via R] [mailto:[hidden email]] Thanks Dieter |
| Powered by Nabble | Edit this page |
