Do gated societies actually provide better security, or is it just marketing?

Are gated communities truly safer, or is it mostly perception?