The biggest improvement to safety from violence you can make is to move out of the USA. Not to buy a gun.
Don't be depressed. (#1 killer with guns)
Don't hang around criminals, or be one
Don't be male and black in the inner city, or hang around black males in the inner city
Avoiding either of those last two reduces the "risk of getting shot" by about 98%. Both, and it's closer to five nines percentages. There is still some latent risk, like from stray bullets, random robberies, negligent discharge, etc. I agree, if you have a tendency to be depressed, you shouldn't own a gun. (Goes for any other mental illness really.)
The FBI and CDC have stats that show this, go look them up. If you line up those rates with those of other countries, US beats most of europe as far is "no violence" most of the time especially if you count recent numbers after lots of immigration.
If you are a white, asian, or hispanic, not a dumbass and not a criminal, having a gun in the house makes no goddamn difference. And you can offset some of the "random robbery" risk to boot. (There are as many as 6 million "defend but no shoot" self defense actions every year. Guns work for that without firing a shot. Many of these are out and about though, so carry concealed or open. There arent many people counting these though, probably for political reasons. NRA has some stats somewhere if you want them.)
Lastly, if you move out of the USA all the positive aspects of a firearm go away, along with freedom of speech, freedom of religion and a bunch of other stuff.
So, basically, "don't be a dumbass" and all of a sudden your "risk of getting shot" drops precipitously.