A continuous positive airway pressure system comprises an inspiratory portion, an expiratory portion, and a controller. The inspiratory portion is coupled to a patient interface to provide an airflow with positive pressure to a patient. The inspiratory portion includes a first sensor to measure a pressure and/or a flow rate of the airflow at the inspiratory portion. The expiratory portion is coupled to the patient interface to receive air exhaled from the patient. The expiratory portion includes a second sensor for measuring a pressure and/or a flow rate of the air exhaled at the expiratory portion. The controller (i) determines a pressure at the patient interface based on the measured pressures and/or the flow rates of the airflow at the inspiratory portion and the air exhaled at the expiratory portion and (ii) modifies the airflow provided by the inspiratory portion based on the determined pressure.