search for: nlxb

Displaying 20 results from an estimated 36 matches for "nlxb".

2013 Jul 09
3
fitting log function: errors using nls and nlxb
...I get the following error: Error in nls((CO2 ~ log(a * Time) + b), start = start, data = FG2) : singular gradient In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf So then when I substituded nlxb for nls in the above two models, I got this error: Error in nlxb((CO2 ~ log(a * Time) + b), start = start, data = FG2) : NaN in Jacobian A few questions: 1.) How can I get R to fit my curve without returning errors? 2.) I am not sure that this data is log base 10. Is there a way I can ask R t...
2017 Jun 18
0
R_using non linear regression with constraints
I ran the following script. I satisfied the constraint by making a*b a single parameter, which isn't always possible. I also ran nlxb() from nlsr package, and this gives singular values of the Jacobian. In the unconstrained case, the svs are pretty awful, and I wouldn't trust the results as a model, though the minimum is probably OK. The constrained result has a much larger sum of squares. Notes: 1) nlsr has been flagged wit...
2013 Oct 03
2
SSweibull() : problems with step factor and singular gradient
SSweibull() :  problems with step factor and singular gradient Hello I am working with growth data of ~4000 tree seedlings and trying to fit non-linear Weibull growth curves through the data of each plant. Since they differ a lot in their shape, initial parameters cannot be set for all plants. That’s why I use the self-starting function SSweibull(). However, I often got two error messages:
2017 Jun 18
3
R_using non linear regression with constraints
https://cran.r-project.org/web/views/Optimization.html (Cran's optimization task view -- as always, you should search before posting) In general, nonlinear optimization with nonlinear constraints is hard, and the strategy used here (multiplying by a*b < 1000) may not work -- it introduces a discontinuity into the objective function, so gradient based methods may in particular be
2023 Aug 20
2
Issues when trying to fit a nonlinear regression model
...theta2 = exp(-1.8), theta3 = -0.05538), data=mod14data2_random) However, I got this error: Error in nls(y ~ theta1 - theta2 * exp(-theta3 * x), start = list(theta1 = 0.37, : step factor 0.000488281 reduced below 'minFactor' of 0.000976562 nlregmod2 <- nlxb(y ~ theta1 - theta2*exp(-theta3*x), start = list(theta1 = 0.37, theta2 = exp(-1.8), theta3 = -0.05538), data=mod14data2_random) summary(nlregmod2) Object has try-error or missing parameters nlregmod2 And I get s...
2017 Jun 18
3
R_using non linear regression with constraints
...aks = brks ) # Green point is brute-force solution # Red point is optimizer solution for myfun2 ##----------end On Sun, 18 Jun 2017, J C Nash wrote: > I ran the following script. I satisfied the constraint by > making a*b a single parameter, which isn't always possible. > I also ran nlxb() from nlsr package, and this gives singular > values of the Jacobian. In the unconstrained case, the svs are > pretty awful, and I wouldn't trust the results as a model, though > the minimum is probably OK. The constrained result has a much > larger sum of squares. > > Notes:...
2023 Aug 20
3
Issues when trying to fit a nonlinear regression model
...15L), class = "data.frame") I did the following to try to fit a nonlinear regression model: #First, Procedure to Find Starting (initial) Values For Theta1, Theta2, and Theta3 mymod2 <- y ~ theta1 - theta2*exp(-theta3*x) strt2 <- c(theta1 = 1, theta2 = 2, theta3 = 3) trysol2<-nlxb(formula=mymod2, data=mod14data2_random, start=strt2, trace=TRUE) trysol2 trysol2$coefficients[[3]] #Fitting nonlinear Regression Model Using Starting Values From Previous Part nonlinearmod2 <- nls(mymod2, start = list(theta1 = trysol2$coefficients[[1]], theta2 = trysol2$coe...
2017 Jun 18
0
R_using non linear regression with constraints
...solution > # Red point is optimizer solution for myfun2 > > ##----------end > > On Sun, 18 Jun 2017, J C Nash wrote: > >> I ran the following script. I satisfied the constraint by >> making a*b a single parameter, which isn't always possible. >> I also ran nlxb() from nlsr package, and this gives singular >> values of the Jacobian. In the unconstrained case, the svs are >> pretty awful, and I wouldn't trust the results as a model, though >> the minimum is probably OK. The constrained result has a much >> larger sum of squares....
2017 Jun 21
1
fitting cosine curve
...fit a curve, but it is different from the real curve, #which can be seen in the figure. linFit <- lm(y ~ cos(t)) library(nlsr) #fullFit <- nls(y ~ A*cos(omega*t+C) + B, #start=list(A=coef(linFit)[1],B=coef(linFit)[2],C=0,omega=.4)) #omega cannot be set to 1, don't know why. fullFit <- nlxb(y ~ A*cos(omega*t+C) + B, data=lidata, start=list(A=coef(linFit)[1],B=coef(linFit)[2],C=0,omega=.04), trace=TRUE) co <- coef(fullFit) fit <- function(x, a, b, c, d) {a*cos(b*x+c)+d} plot(x=t, y=y) curve(fit(x, a=co['A'], b=co['omega'], c=co['C'],d=co['B']), a...
2023 Aug 20
1
Determining Starting Values for Model Parameters in Nonlinear Regression
The cautions people have given about starting values are worth heeding. That nlxb() does well in many cases is useful, but not foolproof. And John Fox has shown that the problem can be tackled very simply too. Best, JN On 2023-08-19 18:42, Paul Bernal wrote: > Thank you so much Dr. Nash, I truly appreciate your kind and valuable contribution. > > Cheers, > Paul &...
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
...gt; theta3 = -0.05538), data=mod14data2_random) > However, I got this error: > Error in nls(y ~ theta1 - theta2 * exp(-theta3 * x), start = list(theta1 = > 0.37, : > step factor 0.000488281 reduced below 'minFactor' of 0.000976562 > nlregmod2 <- nlxb(y ~ theta1 - theta2*exp(-theta3*x), > start = > list(theta1 = 0.37, > theta2 = exp(-1.8), > theta3 = -0.05538), data=mod14data2_random) > summary(nlregmod2) > Object has try-error or missing pa...
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
...did the following to try to fit a nonlinear regression model: > > #First, Procedure to Find Starting (initial) Values For Theta1, Theta2, and > Theta3 > > mymod2 <- y ~ theta1 - theta2*exp(-theta3*x) > > strt2 <- c(theta1 = 1, theta2 = 2, theta3 = 3) > > trysol2<-nlxb(formula=mymod2, data=mod14data2_random, start=strt2, > trace=TRUE) > trysol2 > trysol2$coefficients[[3]] > > #Fitting nonlinear Regression Model Using Starting Values From Previous > Part > nonlinearmod2 <- nls(mymod2, start = list(theta1 = > trysol2$coefficients[[1]], &g...
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
...theta3 = -0.05538), data=mod14data2_random) >> However, I got this error: >> Error in nls(y ~ theta1 - theta2 * exp(-theta3 * x), start = list(theta1 >> = 0.37, : >> step factor 0.000488281 reduced below 'minFactor' of 0.000976562 >> nlregmod2 <- nlxb(y ~ theta1 - theta2*exp(-theta3*x), >> start = >> list(theta1 = 0.37, >> theta2 = exp(-1.8), >> theta3 = -0.05538), data=mod14data2_random) >> summary(nlregmod2) >> Object has...
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
....05538), data=mod14data2_random) >>> However, I got this error: >>> Error in nls(y ~ theta1 - theta2 * exp(-theta3 * x), start = list(theta1 >>> = 0.37, : >>> step factor 0.000488281 reduced below 'minFactor' of 0.000976562 >>> nlregmod2 <- nlxb(y ~ theta1 - theta2*exp(-theta3*x), >>> start = >>> list(theta1 = 0.37, >>> theta2 = exp(-1.8), >>> theta3 = -0.05538), data=mod14data2_random) >>> summary(nlregmod2)...
2023 Aug 19
1
Determining Starting Values for Model Parameters in Nonlinear Regression
..., 1.4188, 1.4157, 1.4686, 1.4414, > 1.4172, 1.4829, 1.4291, 1.4438, 1.4068, 1.4524, 1.4183) > mydata<-data.frame(Mixture, x1, x2, x3, y) > mydata > mymod <- y ~ 1/(Beta1*x1 + Beta2*x2 + Beta3*x3) > library(nlsr) > strt<-c(Beta1=1, Beta2=2, Beta3=3) > trysol<-nlxb(formula=mymod, data=mydata, start=strt, trace=TRUE) > trysol > # or pshort(trysol) > > > Output is > > residual sumsquares = 1.5412e-05 on 20 observations > after 29 Jacobian and 43 function evaluations > name coeff SE tstat...
2012 Nov 15
0
problem in fitting model in NLS function
Bad scaling will waste a lot of everyone's time. I put the data in a data frame mdat, then library(nlmrt) mdat<-read.csv("muzzamil.csv", header=T) fmn <- nlxb(y~a * (x^b), data=mdat, start=c(a=1,b=1), trace=T) fm <- nls(y~a * (x^b), data=mdat, start=c(a=1,b=1), trace=T) fmn2 <- nlxb(y~a2 * ((x-1979)^b2), data=mdat, start=c(a2=1,b2=1), trace=T) fm2 <- nls(y~a2 * ((x-1979)^b2), data=mdat, start=c(a2=1,b2=1), trace=T) found a possible solution qui...
2012 Nov 28
1
Problems with nls
The problem is badly scaled -- parameters from very small to very big. nlmrt package manages a bit better, but scaling would likely make it and nls both happier. nlxb insists on having its data in a data frame. Here's my code rm(list=ls()) Laptop_sale <- c(1405, 1863,2027,2669,2938,5275,6595,6943,8621,10905,12420,22400,32380,31600,34900,43163,47838,47592) CuSale <- Laptop_sale time <- seq_along(Laptop_sale) Bass.Model <- Laptop_sale ~ m * ((p +...
2017 Jun 21
1
fitting cosine curve
If you know the period and want to fit phase and amplitude, this is equivalent to fitting a * sin + b * cos > >>> > I don't know how to set the approximate starting values. I'm not sure what you meant by that, but I suspect it's related to phase and amplitude. > >>> > Besides, does the method work for sine curve as well? sin is the same as cos with
2012 Jul 11
2
nls problem: singular gradient
Why fails nls with "singular gradient" here? I post a minimal example on the bottom and would be very happy if someone could help me. Kind regards, ########### # define some constants smallc <- 0.0001 t <- seq(0,1,0.001) t0 <- 0.5 tau1 <- 0.02 # generate yy(t) yy <- 1/2 * ( 1- tanh((t - t0)/smallc) * exp(-t / tau1) ) + rnorm(length(t))*0.01 # show the curve
2017 Jun 21
0
fitting cosine curve
I'm trying the different parameters, but don't know what the error is: Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates Thanks for any suggestions. On Tue, Jun 20, 2017 at 7:37 PM, Don Cohen <don-r-help at isis.cs3-inc.com> wrote: > > If you know the period and want to fit phase and amplitude, this is > equivalent to