As was stated, negative emotions in a dream help to better cope with stress in real life, nightmares supposedly emotionally prepare us for future troubles.
Scientists even managed to figure out which parts of the brain are “responsible” for nightmares: the islet lobe and the cortex. Such data were obtained using an electroencephalogram on volunteers.
Interestingly, these areas are also activated during a fear in reality. The cortex is responsible for responding adequately to external threats. The islet lobe, in turn, is responsible for emotions.
The second experiment involved 89 volunteers. They were asked to record all the nightmares and emotions they experienced.
Surprisingly, the people who saw the most negative dreams were more emotionally stable to external factors.
Thus, dreams are a kind of training of the mental system in front of real difficulties in life.