0
$\begingroup$

Would like suggestions on how to model data that looks somthing like this. Need to be able to predict at higher values of X where the curve is relatively flat, slightly increasing, and certainly not decreasing. The key thing that I am having trouble fitting well is the initial drop/hook. If this was absent, a lot of S-shaped curves would work. The initial hook is proving hard to model well. Of course a GAM or similar is possible, but not sure how it will predict beyond the range of observed data. Any suggestions?

Theoretical curve

The real data that I am trying to model and that I think should follow a distribution/curve something like that noted above are shown here:

X = 0:51

Y = 0, -0.004, -0.006, -0.011, -0.014, -0.019, -0.024, -0.026, -0.028, -0.03, -0.03, -0.03, -0.03, -0.03, -0.03, -0.027, -0.023, -0.02, -0.016, -0.011, -0.009, -0.007, -0.005, -0.003, -0.001, -0.001, -0.003, 0.005, 0.007, 0.003, 0.005, 0.006, 0.005, 0.01, 0.016, 0.02, 0.017, 0.015, 0.013, 0.012, 0.016, 0.021, 0.01, 0.02, 0.03, 0.03, 0.031, 0.026, 0.027, 0.027, 0.028

$\endgroup$
4
  • 1
    $\begingroup$ You don't supply enough information to provide any objective answer. The reason is that you haven't given us any indication whatsoever of how to extrapolate the data. Lacking that, there's no reason to discount a GAM (or splines or whatever) that will fit the data well. $\endgroup$
    – whuber
    Commented Mar 9, 2021 at 19:52
  • $\begingroup$ GAMs tend to be heavily influenced by the last points in the dataset. In my real dataset, the last few values of Y are random spikes which are expected to be lower in subsequent values of X that have not yet been observed, and that I am trying to predict. Y should plateau, similar to the figure that I provided which is exactly the type of curve that I would like to fit. $\endgroup$ Commented Mar 9, 2021 at 20:27
  • $\begingroup$ (accidentally pressed enter)...As an example, if one were to change the last two values of the vector of Y listed above (that I artificially smoothed for demonstration of the model that I require) to 0.04 and 0.043, the resulting GAM predictions for subsequent values of X (eg. X > 51) would change quite a lot. $\endgroup$ Commented Mar 9, 2021 at 20:33
  • $\begingroup$ Those are good points, but they ask a different question. The problem with the question in its current form is that the suggested answer could luckily work out or it could be terrible, but you haven't provided any information to allow anyone to determine which situation you're in! $\endgroup$
    – whuber
    Commented Mar 9, 2021 at 20:39

1 Answer 1

3
$\begingroup$

Function suggested : Sum of two logistic functions.

enter image description here

$\endgroup$
5
  • $\begingroup$ Can this function be negative? My real dataset starts at the origin (0,0), drops below 0 on the Y axis, then rises. $\endgroup$ Commented Mar 8, 2021 at 2:03
  • $\begingroup$ You should have written this in your question. And you should have scalled the axis on your graph. If this specification was not missing in your question I would have proposed a convenient function. You should correct the graph. Better edit the data in order to avoid the scanning of the graph to get numerical coordinates of the points. $\endgroup$
    – JJacquelin
    Commented Mar 8, 2021 at 6:00
  • $\begingroup$ You're right. Sorry about the plot, I just snipped it from web. My actual data are quite noisy and don't demonstrate the issue well. I probably could just add a term "- d" to your function and it would drop the values. Will play around with it. Thanks for the suggestion. $\endgroup$ Commented Mar 8, 2021 at 12:41
  • $\begingroup$ OK. That is also what I was thinking of : Adding a parameter a_0 to the above formula. If the real data was available I would have tested this model thanks to non-linear regression. Usually I check the method that I propose before posting it. I hope that will work. $\endgroup$
    – JJacquelin
    Commented Mar 8, 2021 at 12:58
  • $\begingroup$ Your method worked great! I modified it slightly: y = a0 + {(a1 - a0) / (1+10^((logEC50_1 - logX)*slope1))} + {(a2-a0) / (1+10^((logX - logEC50_2)*slope2))}. Tried nls function in R and it failed, despite what looked like good starting values to me. Tried nlxb function (nlmrt library) in R and it worked great. Really appreciate the suggestion for adding two logistic equations. I would not have thought of that. $\endgroup$ Commented Mar 9, 2021 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.