nonlinear least square

hi everyone, i need help. I have to calculate the double sigmoid function via the nonlinear regression function. I have to estimate the following parameters:
a1, a2, c1, c2, qmax.
where a1 and a2 are slopes, while c1 and c2 are average values. these parameters are present in the formula that I have to use in the regression. i need to set a function for each parameter.
otherwise I get the error: attempt to apply a non-function.
can someone help me?

I don't fully understand, is it the case that you have some data, that you believe is best fitted by a double sigmoid, and you wish to calculate the fit ? or is it something else ?

No, I have to calculate the parameters using the NLS code. The formula already contains the parameters that the model must estimate and I should therefore set them as a function.
E.g.: a1 = slope of first growth
a2 = slope of second growth
c1= mean of first growth
c2 = mean of second growth
Growth refers to the initials I must estimate. How do I set the functions for parameters?

Sorry, you haven't shared any formula with me.

Sorry, I know. But it isn’t important. I need only the functions for parameteres

I dont know what 'functions for parameters' means. Sorry

I'm sorry, I have to set a single function for the parameters that I have to estimate with non-linear regression.
Parameters:

  • c1 = midpoint if x <0
  • c2 = midpoint if x> 0
  • a1 = slope of the first growth (which should be x <0)
  • a2 = slope of the second growth (x> 0)
  • qmax = final value of double sigmoide curve

The function is:
q_ds = qmin + (qmid - qmin)/(1+exp(-a1*(spread-c1)))+(qmax - qmid)/((1+exp(-a2*(spread-c2))))

i have the value of qmid and i know that:
qds(deltat = 0) = qmid

so, i can make qmin (initial value of the function) explicit as a function of all the other parameters.
qmin = function(a1, a2, c1, c2, qmax) {(exp(-a1(val_spread-c1)+1)(2*qmid+qmid*exp(-a2(val_spread-c2))-qmax))/(exp(-a1(val_spread-c1))(1+exp(-a2(val_spread-c2))))}
I substitute qmin in the qds formula, to have to estimate one less parameter.

qds = function(spread, a1, a2, c1, c2, qmax) {(((exp(-a1(val_spread-(c1))+1)(2(qmid)+qmidexp(-a2(val_spread-c2))-qmax))/(exp(-a1(val_spread-c1))(1+exp(-a2(val_spread-c2)))) + (qmid - (((exp(-a1(val_spread-c1))+1)(2(qmid)+qmidexp(-a2(val_spread-c2))-qmax))/(exp(-a1(val_spread-c1))(1+exp(-a2(val_spread-c2))))))/(1+exp(-a1(x-c1)))+(qmax - qmid)/((1+exp(-a2(x-c2))))))}

Now, by running the nls command:
ds = nls(y ~ qds, data = data)
the error comes out:

Error in object[[3L]][[1L]] : object of type 'symbol' is not subsettable
Inoltre: 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

Can you help me?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.