Want more get-up-and-go in your sex life? An analysis published in the journal HIV Medicine found that smoking, sleep apnea and not starting HIV treatment right away might get in the way.

Since 1986, researchers have been gathering data on active-duty military men and veterans living with HIV in the United States. Among 5,682 study participants, 10% received an erectile dysfunction (ED) diagnosis at some point. Nathan Jansen, DO, of the San Antonio Military Medical Center, and colleagues compared 488 men with ED and 976 men without ED matched by age at HIV diagnosis.

Compared with HIV-positive men who did not have ED, nearly half of the men with ED had been living with HIV for more than four years before they started antiretroviral treatment, and that delay was associated with a twofold increase in the likelihood of an ED diagnosis. In addition, the use of a protease inhibitor for a year or more was associated with an 81% increased risk of developing ED.

Sleep apnea was nearly three times more common among men with an ED diagnosis, and the sleep disorder was associated with a 2.5-fold increase in the risk of developing ED. What’s more, men with ED were twice as likely to smoke, twice as likely to have high blood pressure and more likely to have elevated cholesterol than their peers without ED.