The effect of dreams is to keep us sane. Studies have shown that when a sleeper is awakened during the R.E.M. Stage of sleep[that is when we dream]; the R.E.M stands for rapid eye movement, and is not allowed to dream, after about 4 days the subjects began to show early stage psychosis. Based on this research, Scientists believe that our mind compartmentalizes our daily life events, and during dreams they play out, and we subconsciously analyze and 'handle' the anxiety and stress, these things would continue to cause, if not dealt with.
