Chemical pregnancy???

Hanna
Ok so about a month ago I had a positive pregnancy test 4 days after my missed period. 3 days later I was bleeding with clotting. . Went to the doctor and they said I had a miscarriage. Did some research and came with the conclusion that it was a chemical pregnancy. . What causes it? Had anyone have one before? Is it common? Is it me? Can I have kids?