[R] R_using non linear regression with constraints
Manoranjan Muthusamy
ranjanmano167 at gmail.com
Sun Jun 18 15:24:54 CEST 2017
I am using nlsLM {minpack.lm} to find the values of parameters a and b of
function myfun which give the best fit for the data set, mydata.
mydata=data.frame(x=c(0,5,9,13,17,20),y = c(0,11,20,29,38,45))
myfun=function(a,b,r,t){
prd=a*b*(1-exp(-b*r*t))
return(prd)}
and using nlsLM
myfit=nlsLM(y~myfun(a,b,r=2,t=x),data=mydata,start=list(a=2000,b=0.05),
lower = c(1000,0), upper = c(3000,1))
It works. But now I would like to introduce a constraint which is a*b<1000.
I had a look at the option available in nlsLM to set constraint via
nls.lm.control. But it's not much of help. can somebody help me here or
suggest a different method to to this?
[[alternative HTML version deleted]]
More information about the R-help
mailing list