Another aspect of the invention concerns an apparatus for monitoring and/or treating a patient having a sleep disorder, the apparatus including a flow sensor that senses patient respiration and generates a corresponding flow signal; and an obstruction detector coupled to the flow sensor and adapted to determine a weighted average signal, the weighted average signal being dependent on a weighted av