How to calculate the confidence interval of the x-intercept in a linear regression? Since standard error of a linear regression is usually given for the response variable, I'm wondering how to obtain confidence intervals in the other direction - e.g. for an x-intercept. I'm able to visualize what it might be, but I'm sure there must be a straightforward way to do this. Below is an example in R of how to visualize this:
set.seed(1)
x <- 1:10
a <- 20
b <- -2
y <- a + b*x + rnorm(length(x), mean=0, sd=1)

fit <- lm(y ~ x)
XINT <- -coef(fit)[1]/coef(fit)[2]

plot(y ~ x, xlim=c(0, XINT*1.1), ylim=c(-2,max(y)))
abline(h=0, lty=2, col=8); abline(fit, col=2)
points(XINT, 0, col=4, pch=4)
newdat <- data.frame(x=seq(-2,12,len=1000))

# CI
pred <- predict(fit, newdata=newdat, se.fit = TRUE) 
newdat$yplus <-pred$fit + 1.96*pred$se.fit 
newdat$yminus <-pred$fit - 1.96*pred$se.fit 
lines(yplus ~ x, newdat, col=2, lty=2)
lines(yminus ~ x, newdat, col=2, lty=2)

# approximate CI of XINT
lwr <- newdat$x[which.min((newdat$yminus-0)^2)]
upr <- newdat$x[which.min((newdat$yplus-0)^2)]
abline(v=c(lwr, upr), lty=3, col=4)


 A: I would recommend bootstrapping the residuals:
library(boot)

set.seed(42)
sims <- boot(residuals(fit), function(r, i, d = data.frame(x, y), yhat = fitted(fit)) {

  d$y <- yhat + r[i]

  fitb <- lm(y ~ x, data = d)

  -coef(fitb)[1]/coef(fitb)[2]
}, R = 1e4)
lines(quantile(sims$t, c(0.025, 0.975)), c(0, 0), col = "blue")


What you show in the graph are the points where the lower/upper limit of the confidence band of the predictions cross the axis. I don't think these are the confidence limits of the intercept, but maybe they are a rough approximation.
A: How to calculate the confidence interval of the x-intercept in a linear regression?
Asumptions


*

*Use the simple regression model $y_i = \alpha + \beta x_i + \varepsilon_i$.

*Errors have normal distribution conditional on the regressors $\epsilon | X \sim \mathcal{N}(0, \sigma^2 I_n)$

*Fit using ordinary least square


3 procedures to calculate confidence interval on x-intercept


*

*Taylor expansion (easy to use)

*Marc in the box method (MIB)

*CAPITANI-POLLASTRI (https://boa.unimib.it/retrieve/handle/10281/43053/64388/DECAPITANI_Pollastri.pdf)


First order Taylor expansion
Your model is $Y=aX+b$ with estimated standard deviation $\sigma_a$ and $\sigma_b$ on $a$ and $b$ parameters and estimated covariance $\sigma_{ab}$.
You solve 
$$aX+b=0 \Leftrightarrow X= \frac{-b} a.$$
Then the standard deviation $\sigma_X$ on $X$ is given by: 
$$\left( \frac {\sigma_X} X \right)^2 = \left( \frac {\sigma_b} b \right)^2 + \left( \frac {\sigma_a} a \right)^2 - 2 \frac{\sigma_{ab}}{ab}.$$
MIB
See code from Marc in the box at How to calculate the confidence interval of the x-intercept in a linear regression?. 
CAPITANI-POLLASTRI
CAPITANI-POLLASTRI provides the Cumulative Distribution Function and Density Function for the ratio of two correlated Normal random variables. It can be used to compute confidence interval of the x-intercept in a linear regression. This procedure gives (almost) identical results as the ones from MIB.
Indeed, using ordinary least square and assuming normality of the errors, $\hat\beta \sim \mathcal{N}(\beta, \sigma^2 (X^TX)^{-1})$ (verified) and $\hat{\beta}$'s are correlated (verified). 
The procedure is the following:


*

*get OLS estimator for $a$ and $b$.

*get the variance-covariance matrix and extract, $\sigma_a, \sigma_b, \sigma_{ab}=\rho\sigma_a\sigma_b$.

*Assume that $a$ and $b$ follow a Bivariate Correlated Normal distribution, $\mathcal{N}(a, b, \sigma_a, \sigma_b, \rho)$. Then the density function and Cumulative Distribution Function of $x_{intercept}= \frac{-b}{a}$ are given by CAPITANI-POLLASTRI. 

*Use the Cumulative Distribution Function of $x_{intercept}= \frac{-b}{a}$ to compute desired quantiles and set a cofidence interval.


Comparaison of the 3 procedures
The procedures are compared using the following data configuration:


*

*x <- 1:10

*a <- 20

*b <- -2

*y <- a + b*x + rnorm(length(x), mean=0, sd=1)


10000 diferent sample are generated and analyzed using the 3 methods. The code (R) used to generate and analyze can be found at: https://github.com/adrienrenaud/stackExchange/blob/master/crossValidated/q221630/answer.ipynb 


*

*MIB and CAPITANI-POLLASTRI give equivalent results.

*First order Taylor expansion differs significantly from the the two other methods.

*MIB and CAPITANI-POLLASTRI suffers from under-coverage. The 68% (95%) ci is found to contain the true value 63% (92%) of the time. 

*First order Taylor expansion suffers from over-coverage. The 68% (95%) ci is found to contain the true value 87% (99%) of the time. 


Conclusions
The x-intercept distribution is asymmetric. It justify a asymmetric confidence interval. MIB and CAPITANI-POLLASTRI give equivalent results. CAPITANI-POLLASTRI have a nice theorical justification and it gives grounds for MIB. MIB and CAPITANI-POLLASTRI suffers from moderate under-coverage and can be used to set confidence intervals. 
