Some smart guys did a study, and came to this conclusion....that your dog....readily reacts to your emotional state of happiness or sadness.
It's hard to say how this test was devised, how many dogs were involved, and how they shaped the happy or sad state of emotion. But in the end, they had enough concrete proof to establish that dogs are that smart.
The thing they can't tell you....which breed of dog is more perceptive of your condition than another breed.
I'm of the mind that the Border Collie breed is probably king of this perception business. This particular dog is probably sitting there in anticipation of coming home....thinking of a dozen things to pep up your day....forcing you to play ball with him or react to Frisbee tosses.
The thing is....this breed of dog probably even calculates the happiness state or sadness state of other animals.....from cats to cattle.