ks_plot

ks_plot(pos, sta, history, y, b)

Function to construct Kolmogorov-Smirnov (KS) plot Input: * pos: [, x 1] double - binary (0 or 1), 1 means Supine position at that time interval * sta: [, x 5] double - [N1 N2 N3 REM Wake], binary (0 or 1),

value 1 in each sta column indicates the corresponding stage the participant is in at that time interval

  • history:[, x 9] double - past event activity in the cardinal spline basis

  • y: [, x 1] double - response, binary (0 or 1) event train, 1 means the apnea event happened at that time interval

  • b: [15 x 1] double, fitted parameters

Output: * ks: double, KS statistics * ksT: double, 0: pass the KS test; 1: fail to reject the null * A KS plot will also be drawn to show the goodness-of-fit