CPAP treatment apparatus comprising: a controllable positive airway pressure device operable to produce breathable gas at a pressure elevated above atmosphere; a gas delivery tube coupled to the positive airway pressure device; a patient mask coupled to the tube to receive said breathable gas from the positive airway pressure device and provide said gas, at a desired treatment pressure, to the patient's airway; a controller operable to receive input signals and to control operation of said positive airway pressure device and hence the treatment pressure; and a sensor located to sense patient respiratory airflow and generate a signal input to the controller from which patient respiratory airflow is determined; and characterized in that: the controller is operable to determine the occurrence of an apnea/hypopnea from a comparison of a threshold with short term ventilation, the short term ventilation being an average respiratory airflow over a short time interval; the threshold is based upon long term ventilation, the long term ventilation being an average respiratory airflow over a longer time interval, the long term ventilation is not updated while an apnea/hypopnea event is in progress; and to determine termination of the apnea/hypopnea, how many data points of short term ventilation are above or below the threshold is determined, wherein: if a number of data points of short term ventilation below the threshold is greater than a number of data points of short term ventilation above the threshold, it is assumed the apnea/hypopnea is continuing, and otherwise the apnea/hypopnea event is considered to have ended; and the controller is operable to increase the treatment pressure by an amount in the presence of an apnea/hypopnea. a controllable positive airway pressure device operable to produce breathable gas at a pressure elevated above atmosphere; a gas delivery tube coupled to the positive airway pressure device; a patient mask coupled to the tube to receive said breathable gas from the positive airway pressure device and provide said gas, at a desired treatment pressure, to the patient's airway; a controller operable to receive input signals and to control operation of said positive airway pressure device and hence the treatment pressure; and a sensor located to sense patient respiratory airflow and generate a signal input to the controller from which patient respiratory airflow is determined; and characterized in that: the controller is operable to determine the occurrence of an apnea/hypopnea from a comparison of a threshold with short term ventilation, the short term ventilation being an average respiratory airflow over a short time interval; the threshold is based upon long term ventilation, the long term ventilation being an average respiratory airflow over a longer time interval, the long term ventilation is not updated while an apnea/hypopnea event is in progress; and to determine termination of the apnea/hypopnea, how many data points of short term ventilation are above or below the threshold is determined, wherein: if a number of data points of short term ventilation below the threshold is greater than a number of data points of short term ventilation above the threshold, it is assumed the apnea/hypopnea is continuing, and otherwise the apnea/hypopnea event is considered to have ended; and the controller is operable to increase the treatment pressure by an amount in the presence of an apnea/hypopnea. the controller is operable to determine the occurrence of an apnea/hypopnea from a comparison of a threshold with short term ventilation, the short term ventilation being an average respiratory airflow over a short time interval; the threshold is based upon long term ventilation, the long term ventilation being an average respiratory airflow over a longer time interval, the long term ventilation is not updated while an apnea/hypopnea event is in progress; and to determine termination of the apnea/hypopnea, how many data points of short term ventilation are above or below the threshold is determined, wherein: if a number of data points of short term ventilation below the threshold is greater than a number of data points of short term ventilation above the threshold, it is assumed the apnea/hypopnea is continuing, and otherwise the apnea/hypopnea event is considered to have ended; and the controller is operable to increase the treatment pressure by an amount in the presence of an apnea/hypopnea. if a number of data points of short term ventilation below the threshold is greater than a number of data points of short term ventilation above the threshold, it is assumed the apnea/hypopnea is continuing, and otherwise the apnea/hypopnea event is considered to have ended; and the controller is operable to increase the treatment pressure by an amount in the presence of an apnea/hypopnea.