The paper deals with the problem of data processing in adaptive detection of inspiration / expiration by machines for treating sleep apnea using statistical decision theory and based on preliminary analysis of human respiration. The authors establish a law of noise distribution and develop an inspiration and expiration detection algorithm which envisages calculation of the likelihood ratio, which is compared with the threshold values, at each step. As a result, a conclusion is drawn, and a decision is taken on the need to initiate the treatment of sleep apnea with the machine. The use of this algorithm reduces the detection time by 2-3 times, making it possible to carry out preliminary adjustment of parameters for each patient. The problem of definition of person s respiratory system condition with the use of the methods based on a task of the dosed values of resistance/pressure of switching in a respiratory contour with the subsequent creation of diagnostic matrixes state, in which every line characterizes parameters value at a certain loading for the throttle and relay modes of complexes correcting influence is solved.