The present invention relates to the automatic control of a ventilator machine, for changing over between two alternating phases of ventilation by, in one phase of ventilation, causing a control unit to examine a sensed respiratory signal for breathing activity (¼V) for a threshold criterion (2) for the changeover to the next phase of ventilation. There is in an expiration phase, for the changeover to an inspiration phase, a dynamic threshold curve, and there is in an inspiration phase a dynamic threshold curve, and a changeover is made when the signal for breathing activity threshold curve is crossed. The durations of the inspiration and expiration phases or the duration of a breath (an inspiration and an expiration phase) are each stored and the expected times of the maximum phase durations are derived from the distributions of the phase durations.