A method for diagnosis includes receiving a signal associated with blood oxygen saturation of a patient during sleep. The signal is filtered so as to eliminate signal components at frequencies equal to and greater than a respiratory frequency of the patient. The filtered signal is processed to detect a pattern corresponding to multiple cycles of periodic breathing.