I hope something gets out of this, people have been trying to figure out some sort of formula for a long time now without much success as far as I know. In the best case it's mostly time-based with only fixed amount removed per a small number of specific events. But after grinding a lot with my hunter I sometimes have the impression it goes as far as to depend on the health level you keep your pet while fighting. I mean if you take time to heal your pet and keep him high on health during fights it seems to me the happiness goes down a lot slower. So you may have to record a massive amount of data including damage taken per HP remaining (just like XPerl Grim Reaper would do). I hope you have some good spare time and like data analysis