What could of caused my chemical miscarriage?

Well today I found out I had a chemical miscarriage this was my first time getting pregnant. I'm curious on what caused it. Could it have been because I stayed over at my boyfriends for 2 days and the whole house smells like smoke. Everyone there smokes all kinds of things like cigarettes, marijuana, and ecigs with nicotine. It would make my stomach hurt but did it cause it? If not what did?