It could also be a coping mechanism. You have heard of this kind old man, and you imagine him there to comfort you after a bad dream. I do believe in ghosts, to an extent, so it could also be that.