Described are a positive airway pressure system (1) for treatment of a sleeping disorder in a patient. The system includes a generator (22), a sensor (23) and a processing arrangement (24). The generator supplies airflow and applies a pressure to an airway of a patient. The sensor measures data corresponding to patient's breathing patterns. The processing arrangement analyzes the breathing patterns to determine whether the breathing patterns are indicative of at least one of the following patient's states: (i) a regular breathing state, (ii) a sleep disorder breathing state, (iii) a REM sleep state and (iv) a troubled wakefulness state. The processing arrangement adjusts the applied pressure as a function of the patient's state.