It really depends on the layout of your house and a few other things. Nothing makes someone shit their pants faster than hearing the sound of a shotgun getting ready to unload so that could give you a psychological advantage over your intruder. However, I keep a full size handgun next to my bed in the drawer. (Note: I do not have any kids at my house ever). So you'll want to keep a few things in mind for your gun.
1. Make sure it fits your hand comfortably.
2. Make sure it has a light, or you have a bright flash light nearby to use with it.
3. Make sure you aren't going to over penetrate through walls into other rooms, especially if you have children/Know what your backdrop is.
4. Make sure your gun is safely stored for your living arrangement, but can quickly be accessed in case you need it.
Theres a bunch of other factors that can go in to defending your castle but those are pretty basic stuff there.