The battery is doing positive work on a resistor carrying current i. Thus, ∆W is positive. The work done on the resistor is used to increase its thermal energy; thus ∆Q is positive. As the temperature of the resistor rises, ∆U is positive.