95% Confidence interval for extrapolated value from linear regression? I'm writing a program to estimate the lower limit of detection for a nucleic acid assay. A typical analysis will have 5 concentrations with 10 independent replicates each, the dependent variable being whether or not the nucleic acid was detected. I calculate the probability of detection from the replicates (# positive / total, per concentration), then convert these to a probit score. Most of that is just background and not super important to the question.
I end up estimating the concentration at which the assay can detect nucleic acid 95% of the time by doing a linear regression on the results (x=concentration, y=probit score), and solving the linear equation for y=6.64... (the probit score corresponding to 95%).
How would I get the confidence interval for this extrapolated value? I already have the standard error for the slope and the intercept of the regression, and can compute the 95% CI for both, but I'm unsure how to report the CI for the estimated value/result.
Since it can be affected by both the slope and the intercept, do I just re-calculate the result using the steepest slope ($\hat{m} + \sigma_{\hat{m}}t$, where $\sigma_{\hat{m}}$ is the standard error for the slope and $t$ is the appropriate t-value for the desired confidence interval and degrees of freedom) and lowest intercept ($\hat{b}-\sigma_{\hat{b}}t$), set that as the upper bound of the confidence interval, then recalculate using the shallowest slope and highest intercept ($\hat{m}-\sigma_{\hat{m}}t$ and $\hat{b}+\sigma_{\hat{b}}t$)?
If it's relevant, the program is in Python (3.x) and I'm using scipy.stats for the regression (linregress()) and for finding the width of the confidence intervals (t.ins()). But if someone could just explain the math, I can write the code (I haven't found an obvious answer in the scipy.stats docs).
Cheers!
 A: 
doing a linear regression on the results (x=concentration, y=probit score), and solving the linear equation for y=6.64... (the probit score corresponding to 95%)

probably isn't the best way to accomplish what you want.
A linear regression of probit score against concentration makes an implicit assumption that the variance in probit score  values around their linearly predicted values is constant as a function of concentration. That's unlikely to be the case and might substantially bias the estimate of detection limit.
I think you can better accomplish what you want by doing a proper probit regression that takes the underlying binomial variance into account. That can be further enhanced by allowing for a nonlinear relationship with concentration. You can then plot predicted probabilities along with confidence intervals as a function of concentration. This page shows how to do probit regressions in several platforms including Python.
The Python example doesn't show plots, but plots (and the way to generate them) are illustrated in the R example. You use a "predict" function that returns means and confidence intervals based on the model in the probit scale over a range of concentrations, rescale to probability, and plot.
Some might prefer a logistic regression to the probit regression, but the differences are usually pretty minor.
Finally, the way that you are proceeding doesn't seem to be a standard way of setting detection limits. It's not clear from your description how you are taking into account the variance in blank values. You might want to see this article for guidance.
A: The scipy stats docs include a method for this:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.linregress.html
Copied from there (but I would never use a lambda for this, personally):
# Two-sided inverse Students t-distribution
# p - probability, df - degrees of freedom
from scipy.stats import t
tinv = lambda p, df: abs(t.ppf(p/2, df))
ts = tinv(0.05, len(x)-2)
print(f"slope (95%): {res.slope:.6f} +/- {ts*res.stderr:.6f}")
slope (95%): 1.453392 +/- 0.743465
print(f"intercept (95%): {res.intercept:.6f}"
  f" +/- {ts*res.intercept_stderr:.6f}")
intercept (95%): 0.616950 +/- 0.544475

elsewhere, I find a different solution and created confidence intervals this way:
(probe_data is a dataframe and phenotype is a list of numbers (e.g. 0=control, 1=treatment group) to categorize the columns in the data. scipy returns a results dataframe with some stats, but not the confidence intervals.
alpha is typically 0.05, and results.rvalue is the regression coefficient and results.stderr is the standard error for the regression.
results = scipy.stats.linregress(phenotypes, probe_data)

# add in confidence intervals
r_z_value = np.arctanh(results.rvalue)
z_score = scipy.stats.norm.ppf(1-alpha/2)
# t_score = scipy.stats.t.ppf(1-alpha/2, n_samples)
lo_z = r_z_value - (z_score * results.stderr)
hi_z = r_z_value + (z_score * results.stderr)
ci_lower, ci_upper = np.tanh((lo_z, hi_z))

is that closer to what you are looking for?
