a, Schematic showing transition probability calculation. To calculate the transition probability at a given time bin ( i), we first identified all the trials ( n) in which the animal was in state X ( X could be wake, NREM, or REM) in the preceding time bin ( i − 1). Among these n trials, we identified the subset of trials ( m) in which the animal transitioned into state Y in the current time bin ( i). The X→ Y transition probability for time bin i was computed as m/ n. b, Transition probability within each 10 s period in GABA POA→TMN-ChR2 mice ( n = 9). Shown in each bar is the transition probability averaged across six consecutive 10 s bins within each 60 s. Error bar, 95% confidence interval (bootstrap). The baseline transition probability (grey dashed line) was averaged across all time bins after excluding the laser stimulation period. Direct wake→REM and REM→NREM transitions were not observed and the corresponding plots were omitted. Magenta asterisk (*)/green hash symbol (#) indicates significant increase/decrease in transition probability during laser stimulation compared with the baseline ( P < 0.05, bootstrap). Top right diagram indicates transition probabilities that are significantly increased (magenta), decreased (green), or unaffected (black) by laser stimulation. c, Transition probability in control mice ( n = 8). The probability during laser stimulation was not significantly different from baseline for any transition. d, Transition probability in GABA POA-ChR2 mice ( n = 5).