# Constraining linear regression to yield nonpositive residuals

Is there any literature on linear regression analysis where we require that our residuals are non-positive?

That is, we are interested in minimising:

$\sum_i \max(y_i - b x_i,0)$

EDIT: The motivation comes from Finance. I want to hedge a given portfolio of securities with value $P(t)$ with say $n$ hedging instruments with values $h_i(t)$ at time $t$. Looking at historical data, I want to minimise $max\{\sum_{i=1}^n \alpha_i [h_i(0)-h_i(t)] + [P(0)-P(t)], 0\}$ w.r.t $\alpha_i$, the hedging weights. The one-sidedness come from the fact that I don't mind if my combined portolio increases in value but I do care if it decreases in value.

• What is the motivation for this question? Sep 5, 2011 at 12:32
• Off the cuff, it seems the solution must be a line corresponding to one of the segments of the least concave majorant of the data. Sep 5, 2011 at 12:35
• Here is a similar question and answer. (Forgive the self-citation, please.) Sep 5, 2011 at 13:16
• I'm confused by your edit. Did you mean to put the $\max$ function inside the sum? Also, in the original equation, are you wanting to allow for an intercept or not? Otherwise, by forcing the line through the origin, the answer is trivial. Sep 5, 2011 at 13:26
• No, the max function is supposed to be outside the sum. $P$ is the dependent variable, $h_i$ are the independent variables. My combined (hedging + original) portfolio starts with value $\sum_{i=1}^n \alpha_i h_i(0) + P(0)$ and I want to choose $\alpha_i$ so that at the end of the period $[0,t]$ the negative part of the change in value of the portfolio is minimised. I have just realised that this is trivial, however, if there are no constraints on $\alpha_i$ which, realistically, there would be. Sep 5, 2011 at 14:03

• Perhaps you can expand a little bit and make this answer more self-contained. Sep 5, 2011 at 12:32

It can be formulated as an LP, and hence it's quiet easy to solve in practice.

Alternatively, this problem can be recasted as that of solving Koencker's quantile regression problem for $$\tau$$ set to $$n-p-1$$ (so you can use existing software to do it), where $$p$$ is the number of columns of $$X$$ (assuming $$X$$ contains a column of ones) and $$n$$ is the number of observations. If you are under $$\verb+R+$$ have a go:

quantreg package

# Further details:

Assuming the $$X$$ contains a column of one, the quantile regression problem is

$$\underset{e^+_i,e^-_i}{\arg.\min.} \sum_{i=1}^n(\tau e^+_i + (1-\tau) e^-_i)$$

s.t., $$\forall i$$:

• $$e^-_i\leq 0$$,

• $$e^+_i\geq 0$$,

• $$e^-_i+e^+_i=y_i-\sum_{j=1}^{p}b_jx_{ij}$$

three consequences of the quantile regression objective function are that:

• $$e^-_i<0\Rightarrow e^+_i=0$$
• $$e^+_i>0\Rightarrow e^-_i=0$$
• $$|\{i:e^+_i+e^-_i=0\}|=p+1$$
• Could you explain why that quantile regression problem is equivalent to my own? Sep 5, 2011 at 13:14
• is that enough? Sep 5, 2011 at 13:31
• No, sorry I don't understand. Is $\lfloor(n-p-1)/n\rfloor$ not just zero? Sep 6, 2011 at 16:13