1. A breathing assistance system for providing breathing assistance to a patient, comprising: a pneumatic system for providing breathing assistance to a patient; and a controller configured to control one or more operational parameters of the pneumatic system, the controller configured to estimate a leak flow in a breathing assistance system including a ventilation device connected to a patient by: accessing data of a flow waveform indicating the flow of gas between the ventilation device and the patient; identifying a specific portion of the flow waveform as a steady phase portion; and performing a linear regression of the identified portion of the flow waveform to determine an estimated leak flow in the breathing assistance system; wherein identifying the steady phase portion comprises: identifying a reference period of the flow waveform; determining a representative flow rate for the reference period; determining a series of one or more consecutive qualifying periods of the flow waveform having representative flow rates that vary from the representative flow rate for the reference period by less than a predetermined amount; and defining the steady phase portion as including the reference period and the series of one or more consecutive qualifying periods.