Re: [R] Issues when trying to fit a nonlinear regression model

2023-08-20 Thread Paul Bernal
Thank you so much for your valuable feedback Berwin. Have a great day. Cheers, Paul El El dom, 20 de ago. de 2023 a la(s) 10:21 p. m., Berwin A Turlach < berwin.turl...@gmail.com> escribió: > G'day Paul, > > On Sun, 20 Aug 2023 12:15:08 -0500 > Paul Bernal wrote: > > > Any idea on how to

Re: [R] Issues when trying to fit a nonlinear regression model

2023-08-20 Thread Berwin A Turlach
G'day Paul, On Sun, 20 Aug 2023 12:15:08 -0500 Paul Bernal wrote: > Any idea on how to proceed in this situation? What could I do? You are fitting a simple asymptotic model for which nls() can find good starting values if you use the self starting models (SSxyz()). Well, Doug (et al.) choose

Re: [R] Issues when trying to fit a nonlinear regression model

2023-08-20 Thread Paul Bernal
Thanks a lot Bert, I appreciate your help. Kind regards, Paul El El dom, 20 de ago. de 2023 a la(s) 2:39 p. m., Bert Gunter < bgunter.4...@gmail.com> escribió: > Basic algebra and exponentials/logs. I leave those details to you or > another HelpeR. > > -- Bert > > On Sun, Aug 20, 2023 at 12:17 

Re: [R] Issues when trying to fit a nonlinear regression model

2023-08-20 Thread Bert Gunter
Basic algebra and exponentials/logs. I leave those details to you or another HelpeR. -- Bert On Sun, Aug 20, 2023 at 12:17 PM Paul Bernal wrote: > Dear Bert, > > Thank you for your extremely valuable feedback. Now, I just want to > understand why the signs for those starting values, given the

Re: [R] Issues when trying to fit a nonlinear regression model

2023-08-20 Thread Paul Bernal
Dear Bert, Thank you for your extremely valuable feedback. Now, I just want to understand why the signs for those starting values, given the following: > #Fiting intermediate model to get starting values > intermediatemod <- lm(log(y - .37) ~ x, data=mod14data2_random) > summary(intermediatemod)

Re: [R] Issues when trying to fit a nonlinear regression model

2023-08-20 Thread Bert Gunter
Oh, sorry; I changed signs in the model, fitting theta0 + theta1*exp(theta2*x) So for theta0 - theta1*exp(-theta2*x) use theta1= -.exp(-1.8) and theta2 = +.055 as starting values. -- Bert On Sun, Aug 20, 2023 at 11:50 AM Paul Bernal wrote: > Dear Bert, > > Thank you so much for your kind

Re: [R] Issues when trying to fit a nonlinear regression model

2023-08-20 Thread Ben Bolker
I haven't looked to see whether you or Bert made an algebraic mistake in translating the parameters of the log-linear model to their equivalents for the nonlinear model, but nls() gives me the same answer as nls() in this case (I called my data 'dd2'): n1 <- nlxb(y~theta1 -

Re: [R] Issues when trying to fit a nonlinear regression model

2023-08-20 Thread Paul Bernal
Dear Bert, Thank you so much for your kind and valuable feedback. I tried finding the starting values using the approach you mentioned, then did the following to fit the nonlinear regression model: nlregmod2 <- nls(y ~ theta1 - theta2*exp(-theta3*x), start =

Re: [R] Issues when trying to fit a nonlinear regression model

2023-08-20 Thread Ben Bolker
My answer is WAY longer than Bert Gunter's but maybe useful nonetheless. (Q for John Nash: why does the coef() method for nlmrt objects return the coefficient vector **invisibly**? That seems confusing!) Here's what I did: * as a preliminary step, adjust the formula so that I don't

Re: [R] Issues when trying to fit a nonlinear regression model

2023-08-20 Thread Bert Gunter
I got starting values as follows: Noting that the minimum data value is .38, I fit the linear model log(y - .37) ~ x to get intercept = -1.8 and slope = -.055. So I used .37, exp(-1.8) and -.055 as the starting values for theta0, theta1, and theta2 in the nonlinear model. This converged without

[R] Issues when trying to fit a nonlinear regression model

2023-08-20 Thread Paul Bernal
Dear friends, This is the dataset I am currently working with: >dput(mod14data2_random) structure(list(index = c(14L, 27L, 37L, 33L, 34L, 16L, 7L, 1L, 39L, 36L, 40L, 19L, 28L, 38L, 32L), y = c(0.44, 0.4, 0.4, 0.4, 0.4, 0.43, 0.46, 0.49, 0.41, 0.41, 0.38, 0.42, 0.41, 0.4, 0.4 ), x = c(16, 24, 32,