The first thing people overlook in their home security is the levels of penetration you need.
Everyone automatically assumes that all of the sudden there is gonna be a bad guy in your home wanting to kill you and rape you dog. He should have first had to gotten through a couple other barriers first.
#1) invest in some motion activated light and preferably a camera. In most cases this will cause a criminal to look for as easier less secure target.
#2) Next should be a secure locked door and windows with sturdy physical locks , this will take a significant amount of effort for the criminal get into your home.
#3) a decent security system that is both very loud and allerts local authorities. When a criminal suddenly drawn this much attention to themselves they will not stick around because the element of surprise is gone.
NOW , if a criminal has decided that getting past there barriers to get into your home is worth the risk then they are likely willing to cause you bodily harm and this is where your personal defense tools come into play.
All of these previous barriers work FOR you by deturing a criminal and alerting you to their presence AND if something tragic does happen and you have to shoot someone then your defense can prove that you went above and beyond to prevent a deadly confrontation.
Now onto the order of what weapon you need to have in your home for protection and this is directly related to the level of training you have in CQB , building clearing and communications.
Most people have little to no formal training (under 2000 rounds on a dynamic course is little to no training) and you are likely to end up getting yourself into deep shit.
Look at your house and see what the longest range of engagement is likely to be , typically it's under 10 feet. At 10 feet with a shotgun the pattern is only going to be maybe 2" so it not a "scatter gun" anymore and you are just as likely to miss than you are with a carbine or pistol. A shotgun is also WAY bigger than a pistol making it much easier to get tangled up and taken away from you.
A quality pistol with a quality weapon light is your best option for home defense , it can easily be manipulated with one hand leaving the free hand for the cell phone talking to 911 dispatcher. A 9mm with a quality prefragmented bullet will out a target down very quickly with near zero chance of over penetration or ricochet. The 9mm is cheap to shoot so you are more likely to practice more.
The biggest thing you need to understand is that if you decide to clear your house and go looking for the threat that WILL be used against you when it goes to court. You may easily be exonerated on any criminal charges but you will likely ve sued in civil court for "wrongful death" where you will be looked at as a trigger happy gun nut and the criminal will be made out to be a choir boy that was just mislead.