Why do the robot hosts dream?

Why do the robot hosts dream?

Why do the robot hosts dream? What purpose do the dreams and nightmares serve?