"Best" is usually not, because it requires something that for many doesn't exist, or a commitment most won't make. Add the peculiar situation of defending yourself and family while trapped inside your own home and issues are exponentially raised.
A shotgun may raise a lot of intimidation factor - but only for some, and the response may be an escalation of force that can't be impeded or intended. Like, "put the shotgun down or I kill your kid." It becomes a "mexican standoff" with ego on the line.
First thing for HD is to ask just what were you doing to get their attention in the first place. Then why you didn't have a better exterior defense plan to get the potential intruders to reconsider. Thugs do generally pick on the weak - they prefer no dogs - don't want lights on - dislike exposed entryways - don't need the tells of a burglar alarm system - and are very surprised to find they can't just break the glass and reach in.
But - gun forum - we ignore all the better answers (I didn't say best) and go straight into what gun do I use to shoot them? Kinda like Fiona in Burn Notice, no, shooting them isn't always the best choice. Keeping them out is.
So, they get in, which demonstrates to the neighborhood, cops, and friends everything you could have done failed. Engaging armed intruders inside your home should have been preceded by 1) a call to 911, and 2) you getting out the back door if at all possible. Somehow they have defeated your expensive door, high security locks, and alarm system to step into your home. Why are you still in there? Do you really want a shootout, because once the bullets start flying then you can bet somebody can and will get hit, and the cops will come in right behind them. Now you are downrange from TWO armed groups shooting it out. And your rounds could hit a cop. It's been noted more than once shootings that "innocent" bystanders are hit by police gunfire.
That window security film and German Shepherd are looking like a better deal every second now.
There's an intruder to engage - do you shoot? Did you map out your lanes of fire beforehand? Do you know where the bullets will go? What are the more likely avenues of fire and what is behind you? Hopefully NOT your wife and family - it puts them downrange of the bullets passing you and makes them the backstop. You need to know beforehand what is up - and what will not stop a bullet.
Most homes in America use sheetrock construction hung on 2x4 framing and for the most part ANY bullet can pass thru it. It's not even good enough to withstand getting kicked in by a teenager and it certainly won't contain gunfire. Neither will furniture, appliances, cabinets, and bookcases, which are a rare and dwindling item in today's lifestyle. Nope, you will only have concealment, and gunfire will reduce that cover to splinters pretty quickly. Go look at videos and see for yourself. No way I'm hiding behind a flimsy wall or taking cover behind the refrigerator. But that also goes to the other side - they have no cover, either. Therefore, pick a cartridge that CAN to do the one thing you need done first - get a hit, get the first hits, and keep getting hits. If you can see them then shoot. If you can't see them but know where they are - shoot. Our VP may not be all that well trained about guns, but he does know you can shoot thru stuff, and if the person you are shooting at is a known aggressor who has crossed your personal sense of space, give warning and then shoot. We are NOT the cops, they will be seen as the non-residents in question, and the cops aren't always trying to make things bad for the people they protect.
That's why you DO want ammo capable of penetration. First, you get hits. Second, you know the lanes of fire and you know if you can shoot or not. They don't - they are endangering one and all, even themselves, so the sooner they stop shooting the better.
Do you have an armored position to shoot from? Likely not. In point of fact, it won't help if you are known to be armoring your home to entrap thugs and kill them. Don't - keep them out first.
You may have read where some plan to hide in a safe place where the intruders can't enter, be careful because all it does it trap you there. If that place is armored - literally plated with bullet proof materials which cannot be penetrated, then, is it also burn proof? If they have a 15 minute head start on the cops then things could go downhill quickly, and not being able to exit a burning home would be a difficult circumstance to overcome. If you are out in the country even more so as response times lengthen. Do you see how some decisions create a cascade of new circumstances where things could get worse? Be careful what you read on the internet, a lot of stuff is posted up but as I hope I've pointed out, it's not always in your best interest. There is no best. What you want is something better than what you have, and for the most part the casual thief or burglar passes by. Too high a risk or just too much work.
Soon enough the cops will show up. Expect to be put in handcuffs, regardless of your attire, and then escorted out the door for the TV cams to broadcast later. I'll ask once again - doesn't that security window film and German Shepherd sound even more attractive now? After all, you will eventually be asked why you spent the money on an arsenal of guns and ammo when $150 of break resistant plastic film would have prevented it. (I know, I sound like I'm shilling for them, check the Europeans - they are 15 years ahead on this.) BTW, that video can become file footage for the next shooting and you get to see it all over again. For years.
Better to figure out how to avoid all that silliness. Pick whatever gun you like if you think it fits your best use. Done right, you won't ever have to use it - all the other things you did to reduce your public signature as an excessive consumer who needs to be robbed and beaten, or who is too tough to bother with need to be done first.
Like, tis the season, don't leave those expensive boxes out in the trash. Cut them down and parcel them out weeks later when they fit and nobody sees what they were. You make it harder for thugs to know which house to pick - nobody needs the Wet Bandits in their basement glued to the stairs or hanging off a slide for life to the treehouse. They don't need to be shot - if they never choose your house or get into it.