build_design_mx¶
- build_design_mx(bin, Fs_pos, ord, event_info, hypnogram, rawposition)¶
- Function to convert saved data to design matrix and response
Input: * bin: [double],bin size, bin = 1 (sec) in the paper * Fs_pos: [double],sampling frequency of raw position data, Fs_pos = 32 Hz for MESA dataset * ord: [double] total order of history length, ord = 150 in the paper * event_info: [N x 3] double - [event_start_time(sec), event_duration(sec), event_type], N is total number of events
event_type - 1: hypopnea, 2: OSA, 3: Central
- hypnogram: [, x 3] double - [stage_start_time(sec), stage_duration(sec), sleep stage]
sleep stages (5: Wake, 4: REM, 3: N1, 2: N2, 1: N1);
- rawposition: [,x 1] double, sleep position train in sampling frequency Fs_pos
Raw labels: 0: Right; 1:Supine(Back); 2:Left; 3:Prone; 4:Upright
Output: * 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
Sp: [ord x 9] double - cardinal spline matrix
isis: [,x 1] double - inter-event-intervals
Created by Shuqiang Chen,08/08/2022
Construct respiratory event train