3
$\begingroup$

I have a system that transit between two different states. Each state output varies linearly with time, given by m*t+c, where both lines intersect the x axis in the same point. The output of this system is something like this:

ramp

Is there any easy way to fit these points in order to get the parameter for the lines? This would mean assigning each point to be fitted by a different line.

This question is related to ion channel biophysics. Single channels vary between open and closed states. The current that goes trough the system depends on the state of the channel and the voltage. If we observe a single channel while we change the voltage we'll see something like the image. Something like this can be observed in this paper (figure 2 panel E).

I would like to generalize this later in three ways:

1) One of the lines will be a parabola

2) I could get several time series like the one in the graph, with the idea of fitting all of them to the same set of parameters.

3) Having more than two lines.

Help in this secondary items is not necessary but appreciated.

The dataset from wich I constructed the graph is here: data

What I have tried so far: 1)Giving manual estimation for the two lines, separate the values depending on how close they are to this first estimation and fit every set of values independently. The fit doesn't converge.

$\endgroup$
5
  • $\begingroup$ If you make simple manual estimated parameter values from a scatterplot, you can then find all points within +/- some small amount from those estimates. Those can be plotted to determine procedural accuracy, and if sufficiently accurate in terms of point selection then you can regress those separate point groups. In theory, a GUI program could be made to assist in performing this procedure - I know this would be straightforward using tkinter and matplotlib if you use Python, but most any programming language that can make scatterplots and regressions would also work. $\endgroup$ Commented Aug 9, 2018 at 14:01
  • $\begingroup$ @JamesPhillips The problem comes when the values are near 0, then its hard to detect if they belong to one or the other line. This might not be a problem in this case (lines), but for other kind of functions might become tricky. $\endgroup$
    – BPinto
    Commented Aug 9, 2018 at 15:35
  • $\begingroup$ You can trivially exclude a few points in this region without significantly affecting the fit parameters, so that can be a part of the programming - just as points outside the estimates are excluded, points near a "crossing" can be excluded in the same way. $\endgroup$ Commented Aug 9, 2018 at 16:01
  • $\begingroup$ @JamesPhillips I tried to use a estimate for each line and assign data to be fitted by a new line. The problem is that this fit does not converge into a satisfactory solution. $\endgroup$
    – BPinto
    Commented Aug 9, 2018 at 22:29
  • $\begingroup$ From your posted data set, the procedure should have separated the data into two groups - each of which should easily be fit to a straight line. I recommend scatterplotting each group to verify that this is the case. $\endgroup$ Commented Aug 10, 2018 at 18:14

0

Your Answer

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

Browse other questions tagged or ask your own question.