Described are a positive airway pressure system and method for treatment of asleeping disorder in a patient. The system includes a generator, a sensor anda processing arrangement. The generator supplies airflow and applies apressure at to an airway of a patient. The sensor measures data correspondingto patient's breathing patterns. The processing arrangement analyzes thebreathing patterns to determine whether the breathing patterns are indicativeof at least one of the following patient's states: (i) a regular breathingstate, (ii) a sleep disorder breathing state,.(iii) a REM sleep state and (iv)a troubled wakefulness state. The processing arrangement adjusts the appliedpressure as a function of the patient~s state.