I think the answer will depend a lot on individual needs and circumstances.
In the abstract, a shotgun is undoubtedly a lot more effective than any handgun.
The long arm is probably a lot more cumbersome in close quarters, however. Also, in the event that moving around the house should prove necessary for the purpose of ensuring the safety of others, it may also be more easily grabbed by a home invader. It generally keeps two hands occupied. Finally, it is best suited to "keeping somewhere", and one just might not be able to get to that "somewhere" safely.
For me, a hand gun kept on my person seems to be the right answer. However, I seriously doubt that there is any right answer that would meet the needs of everyone. One has to evaluate his or her needs and make his or her own decision.
In each of the three instances in which I have had to bring a firearm into play, I have used a handgun. No shots were fired, fortunately.