You can't "guess" the remaining battery time, as that depends on the user activity.
A simple action from the user as increasing or decreasing screen bright or turning on or off WI-FI or data connection or even making a few calls, will be enough to increase or decrease the amount of remaining time.
You can extrapolate and try to guess, after analising for a few minuts of device operation, but will never be precise, or even close to that, unless the user leaves the phone still and does not touch it.