This is a big issue for coming to a conclusion. Pretty much 100% of people who shoot up schools are going to be considered depressed so likely they will be on meds. One way around it would be find another country with guns who doesn't issue certain medications for depression the US does. If they have lots of guns, no meds, and very few shool shootings, maybe there's something to it.
I am sure this whole deal is multifactorial enough to make all of our heads spin. There is probably some cool statistical wankery that can help disentangle some of it, machine-learning has really upped the level of wankery possible, but I don't understand any of it.