(CNN) The suicide rate rose 41% in the United States from 1999 to 2016, and the people at the highest risk have a few factors in common, according to a study published in the journal JAMA Network Open on Friday.

Men had higher suicide rates. Areas with the highest risk were in Western states, and in rural areas. Or, in a city, if there was a gun shop in the neighborhood.

"With the gun shop, this is a new variable that hasn't really been looked at, so that definitely needs more research, but we think it is about accessibility," said co-author Danielle Steelesmith, a researcher with the Ohio State University Wexner Medical Center.

The majority of the nearly 40,000 gun deaths in the United States in 2017 were due to suicide, according to US Centers for Disease Control and Prevention data.

People who were uninsured were also more at risk for suicide.