Described is a system including a sensor and a processing arrangement. The sensormeasures data corresponding to a patient's breathing patterns. The processingarrangement analyzes the breathing patterns to determine whether the breathingpatterns are indicative of a REM sleep state. In another embodiment, the processingarrangement analyzes the breathing patterns to determine whether the breathingpatterns are indicative of one of the following states: (i) a wake state and (ii)a sleep state. In another embodiment, a neural network analyzes the data to determinewhether the breathing patterns are indicative of one of the following states:(i) a REM sleep state, (ii) a wake state and (iii) a sleep state. In another embodiment,the processing arrangement analyzes the data to determine whether the breathingpattern is indicative of an arousal.