A methodology and apparatus for determining a target ventilation setting for delivering ventilatory support based upon a function of measured PCO2. Patient ventilation is measured over time during a learning period in which ventilatory support is provided. A target ventilation is calculated as a function of the measured ventilation. Adjustments to the target ventilation are then made using a measure of partial pressure of CO2 for the patient. Preferably, the measure is compared to a threshold PCO2 and the target ventilation may be increased or decreased based upon the comparison. The target ventilation may then be increased or decreased based upon a fixed percentage of the absolute value of the difference between the measured PCO2 and the threshold PCO2.