You know what happens when you try to sleep after a stressful day; you stare at the ceiling and barely get any rest. Turns out dogs are a lot like us.

A team of Hungarian researchers found that dogs often have sleep problems after having negative experiences. The researchers delved into the world of sleeping dogs after realizing that little work has been done on the impact of stress on sleep in many non-human species.

For the study, they signed up 16 adult dogs of various breeds, including vizslas, retrievers and many mixed breed pups. Each dog was subjected to either a positive or negative experience. For the positive experiences, the pets spent six minutes playing fetch or tug of war or being petted by their owners. Dogs that were faced with negative experiences were tied to a door on a leash and ignored by their owners or were approached in a threatening way by a researcher who made direct eye contact, but said nothing.

Wearing EEG sensors, the dogs were then allowed to head off and go to sleep. Meanwhile, the owners were asked to fill out a personality questionnaire for their pets, called the Canine Big Five Inventory, in which they scored their dogs on 43 statements. The questionnaire measures five personality traits: neuroticism, extraversion, openness, agreeableness and conscientiousness.

Stress played out in sleep

The dogs were allowed to sleep for up to three hours while researchers monitored their brain waves. The dogs that had experienced a negative event fell asleep about twice as fast as the relaxed dogs, a strategy the researchers believed to be a protective response from the body to escape stress. The dogs that had negative experiences spent only about 40 to 50 minutes of deep REM sleep, compared to the non-stressed dogs that got about an hour.

The researchers point out that a dog's personality has some impact on how stress affects his everyday life. Playful dogs, for example, react to social stressors much differently than more introverted ones.

Researchers say the results of the study, which was published in the journal Proceedings of the Royal Society B, could be helpful for dogs facing various social stressors. That includes things like being kenneled, environmental changes or competing in sporting events.

Although one restless night isn't likely to do much damage to your dog's health, you know how much a bad night's sleep does for you the next day. If you want to help your dog catch some zzz's, the researchers point out that past studies have found there are things you can do.

Softy talking to your dog, gently stroking him with long, smooth strokes, and slowly scratching his body and ears have been found to increase dogs' level of oxytocin, the "feel good" hormone.

Mary Jo DiLonardo writes about everything from health to parenting — and anything that helps explain why her dog does what he does.