An interesting article by some researchers from the University College in London describes the equation they constructed and tested that predicts happiness.
A key part of the equation is that it relates happiness to the difference between people’s expectations of rewards and the actual rewards.
… we show that emotional reactivity in the form of momentary happiness in response to outcomes of a probabilistic reward task is explained not by current task earnings, but by the combined influence of recent reward expectations and prediction errors arising from those expectations.
— Rutledge et al., 2014. A computational and neural model of momentary
subjective well-being, in PNAS Early Edition.