# Box-Cox back transformation with indicator in linear regression

I have a fitted linear regression of a Box-Cox transformed dependent variable, using an indicator variable as one of the two predictors :

$$g(Q, \lambda) = \hat{\beta_0} + \hat{\beta_1}P+ \hat{\beta_2}I +\epsilon = f(P,I) +\epsilon$$

This generates two parallel lines of slope $$\beta_1$$ and intercepts $$\beta_0$$, when $$I=0$$, and $$\beta_0+\beta_2$$, when $$I=1$$. $$g(Q, \lambda)$$ would be the Box-Cox transformation of $$Q$$ by parameter $$\lambda$$

I am interested in estimating how $$Q$$ (untransformed) changes, given a value of $$P = \bar{P_0}$$ when $$I$$ changes from $$0$$ to $$1$$. Note that $$\bar{P_0}$$ is actually the average of the values of $$P$$ where $$I=0$$, eventually I need to do the same for $$\bar{P_1}$$, i.e. the average of $$P$$ when $$I=1$$, but I guess that's just repeating the same procedure.

Since, I need $$Q$$ in the untransformed space, It is my understanding that I need to correct for bias in the back transformation process, for this I am fiddling with Duan's smearing, using the following formula to find $$Q$$ as a function of $$I$$:

$$Q(I) = \frac{1}{n}\sum_{i=1}^nh(f(\bar{P_0},I) + \hat{\epsilon}_i, \lambda)$$

where $$f$$ is the linear regression model above, $$h = g^{-1}$$ is the inverse of the Box-Cox transformation and $$\hat{\epsilon}_i$$ are the residuals of the fitted linear regression.

Hoping to be using the right approach, there are a few things that I am finding unclear:

1. The domain of the inverse transformation of Box-Cox is not the entire number line. in my formula above, it requires $$f(P_0,I) + \hat{\epsilon}_i > \frac{-1}{\lambda}$$. I have a few points where this condition doesn't hold, and my reverse transformation is impossible. This doesn't seem to be an issue that is considered in the (admittedly sparse) literature I have found on the topic (e.g. this article), so I'm not sure how to deal with it. At the moment I am substituting the entire $$h(\cdot, \lambda)$$ term with $$0$$ in these cases because logically that makes the most sense to me given the data ($$Q$$ and $$P$$ are volumes, so cannot be negative) and the shape of the Box-Cox transformation. Is there a better approach?

2. How should I deal with the indicator variable when taking the $$\hat{\epsilon}_i$$ to add to the sum? Should I use all the residuals regardless of the value of $$I$$ that I am testing for, or only the residuals of the data points with $$I$$ matching the one I am testing at the specific moment? I guess that mostly means asking if I should consider the two lines that come out of the regression as two separate models or as a single one. I can see benefits and pitfalls in both approaches and admittedly the results I get are not that different. Still would be good to understand what the best practice is.