If you are an adult, it's usually a combination of genetics and environmental factors.
Sometimes, the body has a problem producing antibodies (ab) that protect you from pneumonias. Your doctor can determine levels of ab classes. Also, specialists like infectious diseases
doctors, can perform a vaccine challenge test to diagnose more complex problems like common variable immunodeficiency(cvid).