# Calculate xhalf from exponential fit.

Hello,

I am performing fits of some data (y-value as a function of time) and I am ordinarily using the in-built Sigmoid fit function to obtain a measure of the time taken to reach the half-value of the fit (or xhalf per the Igor output naming) for a given parameter.

I cannot use the Sigmoid fit for the entire time series of my data, where the exp_Offset fit is better suited and fits the data nicely. However, I am unsure of how to modify the equation to provide an xhalf output for the exp_Offset fit as in the Sigmoid fit.

I have attached an example data set where I fit points 0 to 39 with a Sigmoid fit and points 47 to 69 with an exp_Offset fit.

Any help with calculating the half-time for this parameter would be greatly appreciated.

The problem with what you want is that the starting value is poorly defined. The XHalf would be at the X point where Y is at (Y1 - Y0)/2. The question then is what is the Y0 (minimum Y value)? A sigmoid has a well-defined Y0, what the fit calls "base". It looks to like both segments of your data are better described as exponentials. The data also show a sort of baseline around 14.34. If that is your Y0, then you can compute XHalf in a well-defined manner.

Having said all that, if you do something like that, you should be prepared to convince your colleagues that it is consistent with the science behind those data.

I would use data at around 14.34 as Y0 for fitting data between points 0 to 39 with a Sigmoid because it has a nice baseline. We have used that fit for previously published data so no need of convincing colleagues for that kind of fit! However, I can't used points 0 to 9 as a baseline for points 40 onwards as we impose an intervention between points 40 and 46 (or 60-75 ms) which provides a new "baseline" ie point 46. Hence why I was wondering if the exponential equation can be modified to provide a half-value as you described above but as a function of the time, even if Y0 is a single data point.

So in other words, at what time on the x-axis does (Y1 - Y0)/2 in an exponential fit occur and can the equation be modified to represent this, and would it work with a single data point at y0? It fits well, I just need the xhalf as an output variable rather than Tau for example.

Well..... with some misgivings :)

If you start from a fit to exp_XOffset, then

Ymax = Y0 or w_coef[0]
Ymin = M04_Ramp_SM3[46]
Yh = (Ymax + Ymin)/2

.... some algebra happens starting with Y = Y0 + A*exp(-(x-x0)/tau) ....

Then

`Xh = W_fitConstants[0] - ln((yh - w_coef[0])/w_coef[1])*w_coef[2]`

Using the data in your example, doing a fit to exp_XOffset to the range [46,75]:

CurveFit/M=2/W=0/TBOX=(0x316) exp_XOffset, M04_Ramp_SM3[46,75]/X=Ramp_Time[46,75]/D
Fit converged properly
Curve fit with data subrange:
M04_Ramp_SM3[46,75]
fit_M04_Ramp_SM3= W_coef[0]+W_coef[1]*exp(-(x-W_fitConstants[0])/W_coef[2])
W_coef={14.516,-0.26207,5.5612}
W_fitConstants={72.9}
V_chisq= 0.00097148;V_npnts= 30;V_numNaNs= 0;V_numINFs= 0;
V_startRow= 46;V_endRow= 75;
W_sigma={0.00138,0.00529,0.212}
Coefficient values ± one standard deviation
y0  = 14.516 ± 0.00138
A   = -0.26207 ± 0.00529
tau = 5.5612 ± 0.212
Constant:
X0  = 72.9
Variable yh = (W_coef[0] - M04_Ramp_SM3[46])
Variable xh = W_fitConstants[0] - ln((yh - w_coef[0])/w_coef[1])*w_coef[2]
print xh
50.6789

An alternative to Ymin would be the fit curve value at X0, which is a bit higher than your data point 46. I don't think it would change Xh much, and there's some chance of coming up with an estimate of uncertainty for the value. Coming up with uncertainty for Xh from all this would be challenging, and left to the customer as an exercise :)