search for: nlslm

Displaying 14 results from an estimated 14 matches for "nlslm".

2017 Jun 18
2
R_using non linear regression with constraints
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,...
2017 Jun 18
3
R_using non linear regression with constraints
...pus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sun, Jun 18, 2017 at 9:43 AM, David Winsemius <dwinsemius at comcast.net> wrote: > >> On Jun 18, 2017, at 6:24 AM, Manoranjan Muthusamy <ranjanmano167 at gmail.com> wrote: >> >> 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)) >>...
2017 Jun 18
0
R_using non linear regression with constraints
> On Jun 18, 2017, at 6:24 AM, Manoranjan Muthusamy <ranjanmano167 at gmail.com> wrote: > > 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)} > > an...
2017 Jun 18
0
R_using non linear regression with constraints
...tes: 1) nlsr has been flagged with a check error by CRAN (though it is in the vignette, and also mentions pandoc a couple of times). I'm working to purge the "bug", and found one on our part, but not necessarily all the issues. 2) I used nlxb that requires an expression for the model. nlsLM can use a function because it is using derivative approximations, while nlxb actually gets a symbolic or automatic derivative if it can, else squawks. JN # Here's the script # # # Manoranjan Muthusamy <ranjanmano167 at gmail.com> # library(minpack.lm) mydata=data.frame(x=c(0,5,9,13,17...
2017 Jun 18
3
R_using non linear regression with constraints
...aggregate( ( objdta$myfun - objdta$y )^2 , objdta[ , c( "a", "b" ) ] , FUN = function( x ) sum( x, na.rm=TRUE ) ) objdtassmin <- objdtass[ which.min( objdtass$x ), ] 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 ) ) a <- as.vector( coef( myfit )[ &...
2017 Jun 18
0
R_using non linear regression with constraints
...$y )^2 > , objdta[ , c( "a", "b" ) ] > , FUN = function( x ) > sum( x, na.rm=TRUE ) > ) > objdtassmin <- objdtass[ which.min( objdtass$x ), ] > > 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 ) > )...
2012 Oct 18
3
Upper limit in nlsLM not working as expected
Dear all, I am using the nlsLM function to fit a Lorentzian function to my experimental data. The LM algorithm should allow to specify limits, but the upper limit appears not to work as expected in my code. The parameter 'w', which is peak width at half maximuim always hits the upper limit if the limit is specified. I wo...
2012 Sep 16
1
trying to obtain same nls parameters as in example
...2473,1.2151,1.0591,1.0108,0.914,0.7903,0.7312,0.6613,0.5914,0.5323,0.4462,0.3226,0.2688,0.2366) test <- data.frame(X = X, Y = Y) and I tried fit0 <- nls(Y ~ a * (1 + b * log(1 - c * X^d)), data = test, start = list(a = 1.75, b = .22, c = .99, d = .005)) and library(minpack.lm) fit2 <- nlsLM(Y ~ a * (1 + b * log(1 - c * X^d)), data = test, start = list(a = 1.75, b = .22, c = .99, d = .005), control = nls.lm.control(maxiter = 100)) I'm not an expert in fitting models so I'm wondering if there is something I'm missing. I would appreciate your comments/hints. Thanks PM
2023 Nov 06
1
non-linear regression and root finding
...ils with >> the message "Singular gradient". I wish that R could have a more >> reliable built-in nonlinear least squares solver. (I could also be >> holding it wrong.) Meanwhile, we have excellent CRAN packages nlsr and >> minpack.lm: >> >> minpack.lm::nlsLM( >> ? pHobs ~ pHm(SID, pK1, pK2, pK3), >> ? data.frame(pHobs = pHobs, SID = SID), >> ? start = c(pK1 = pK1, pK2 = pK2, pK3 = pK3), >> ? # the following is also needed to avoid MINPACK failing to fit >> ? lower = rep(-1, 3), upper = rep(9, 3) >> ) >> # Nonli...
2023 Nov 06
1
non-linear regression and root finding
...obian of the model function cannot be inverted and fails with the message "Singular gradient". I wish that R could have a more reliable built-in nonlinear least squares solver. (I could also be holding it wrong.) Meanwhile, we have excellent CRAN packages nlsr and minpack.lm: minpack.lm::nlsLM( pHobs ~ pHm(SID, pK1, pK2, pK3), data.frame(pHobs = pHobs, SID = SID), start = c(pK1 = pK1, pK2 = pK2, pK3 = pK3), # the following is also needed to avoid MINPACK failing to fit lower = rep(-1, 3), upper = rep(9, 3) ) # Nonlinear regression model # model: pHobs ~ pHm(SID, pK1, pK2, pK3) #...
2023 Nov 06
2
non-linear regression and root finding
...annot be inverted and fails with > the message "Singular gradient". I wish that R could have a more > reliable built-in nonlinear least squares solver. (I could also be > holding it wrong.) Meanwhile, we have excellent CRAN packages nlsr and > minpack.lm: > > minpack.lm::nlsLM( > pHobs ~ pHm(SID, pK1, pK2, pK3), > data.frame(pHobs = pHobs, SID = SID), > start = c(pK1 = pK1, pK2 = pK2, pK3 = pK3), > # the following is also needed to avoid MINPACK failing to fit > lower = rep(-1, 3), upper = rep(9, 3) > ) > # Nonlinear regression model > #...
2012 Oct 23
1
help using optim function
Hi, am very new to R and I've written an optim function, but can't get it to work least.squares.fitter<-function(start.params,gr,low.constraints,high.constraints,model.one.stepper,data,scale,ploton=F) { result<-optim(par=start.params,method=c('Nelder-Mead'),fn=least.squares.fit,lower=low.constraints,upper=high.constraints,data=data,scale=scale,ploton=ploton)
2013 Apr 01
2
Is DUD available in nls()?
SAS has DUD (Does not Use Derivatives)/Secant Method for nonlinear regression, does R offer this option for nonlinear regression? I have read the helpfile for nls() and could not find such option, any suggestion? Thanks, Derek [[alternative HTML version deleted]]
2023 Nov 06
2
non-linear regression and root finding
Dear friends - I have a function for the charge in a fluid (water) buffered with HEPES and otherwise only containing Na and Cl so that [Na] - [Cl] = SID (strong ion difference) goes from -1 mM to 1 mM. With known SID and total HEPES concentration I can calculate accurately the pH if I know 3 pK values for HEPES by finding the single root with uniroot Now, the problem is that there is some