Negative linear regression (time value)

#1
hey all,
I'm working on a basic program for calculating the time remaining as a battery of a device runs down from 100% (full) to 0% (empty).

In theory this is a negative linear regression, but when I use standard formulas I get large positive time values. I assume I need to solve for x (time) when y (battery percentage) is 0. So x = a/b (for negative regression). I am using these equations.

Regression Equation(y) = a + bx
Slope(b) = (NΣXY - (ΣX)(ΣY)) / (NΣX^2 - (ΣX)^2)
Intercept(a) = (ΣY - b(ΣX)) / N

My results give:
100% = 0 minutes remaining
0% = 3192 minutes remaining

How do I invert my equations (or results) so when y=0%, time also equals 0. The system runs in real time, so I can't just subtract 3192 from the regression formula. I need a generic formula to work on a variety of devices.

Any ideas?
 
Last edited:

jrai

New Member
#2
It is difficult to say what is going wrong without analyzing the data but one thing is clear that you're trying to predict 'time remaining' from battery percentage. Your current equation predicts the reverse i.e. battery from time remaining.

I'd say reverse the equation & then post the regression results from your tools.