It's a little weird to compare local crime hotspots to a national average. Costa Rica seems to have about twice the murder rate of the U.S., but that's still low. By "low", I mean if the average accurately represents your risk, it wouldn't be worth worrying about day to day.
Safety is highly situational, and it depends a lot on the way crime happens. If it's criminals killing criminals (e.g. gangs), ordinary citizens and visitors might be fine. But if there is a lot of opportunistic crime, a foreigner might be a target.
https://www.statista.com/statistics/984826/homicide-rate-cos...
https://www.sfchronicle.com/crime/article/Homicides-are-up-3...