Using trapezoidal method (because I have a vector and no function is available) I know how to calculate the area difference one gets when the integral (Fig. 1) is cut by a horizontal line such as the mean (Fig. 2). The areas above the line become positive, the areas below negative.

$$\quad\sum_{k=1}^{N}\frac{x_{ik-1} + x_{ik}}{2}\Delta t_k-\bar{x}_{i}\big(t_{k} - t_{1}\big)$$

But how to do this when the line has a slope, such as a quantile regression line (Fig. 3)?

enter image description here

  • $\begingroup$ Your question is very hard to understand. Are you asking how to draw a line such that the areas on both sides compensate each other ? If the slope is known, solve the horizontal problem on $x-st$. $\endgroup$ – Yves Daoust Feb 15 at 10:59
  • $\begingroup$ Apologies, I've edited the question, hope now it's clear. I'm looking for what's left when a given line cuts the integral and some compensation occurs. $\endgroup$ – jay.sf Feb 15 at 11:29
  • $\begingroup$ Just subtract the line. $\endgroup$ – Yves Daoust Feb 15 at 11:30
  • $\begingroup$ Do you mean, just replace the part after the first minus with the line slope? $\endgroup$ – jay.sf Feb 15 at 11:43
  • $\begingroup$ Replace $x$ by $x-st$. $\endgroup$ – Yves Daoust Feb 15 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.