Sleep Statistics

Once you have scored the record, you can then run the sleep statistics for that record. You can either run the sleep stats from the matlab command line described below or you can use the menu option "Sleep Stats->run".

This will create a few figures that will open and close and will produce the following output in your current directory:

  • stageStats.html - a web page summary of your statistics results. Click here for an example.
  • stageStats_hyp1.jpg - a plot of the hypnogram colored by NREM-REM cycle used in the web page summary.
  • stageStats_hyp2.jpg - a plot of the hypnogram with slow wave sleep collapsed, colored by NREM-REM cycle used in the web page summary.
  • stageStats_SPdist.jpg - a plot of the sleep percentage distribution of all the stages.
  • stageStats_stats.mat - a file containing a struct of all the statistics output.

stageStats

When you load stageStats_stats.mat you will get a struct called stageStats. This struct contains all of the statistics data in the following fields:

  • lightsOUT - A string containing the time of lights out.
  • lightsON - A string containing the time of lights on.
  • milestones - A matrix containing the following rows:
    • The sleep onset epoch relative to lights off (column 1) and the record start (column 2)
    • The epoch of final awakening relative to lights off (column 1) and the record start (column 2)
    • The first scored epoch relative to the record start (column 1 only)
  • lastStageSleep - The name of the last stage of sleep.
  • awakeLightsOn - Indicates if the subject was awake at lights on.
  • percentSleep - The entire sleep percentages table. Refer to the web output to see how this table is organized.
  • SleepLat - The entire sleep latency table in epochs (column one) and minutes (column two). Refer to the web output to see how this table is organized.
  • split4 - The "Quarters" table that shows the percentage of all the sleep stages in each quarter of the sleep period time (SPT).
  • quarterBounds - The time (in epochs) of the start and end of each quarter relative to lights off.
  • split3 - The "Thirds" table that shows the percentage of all the sleep stages in each third of the sleep period time (SPT).
  • thirdBounds - The time (in epochs) of the start and end of each third relative to lights off.
  • cycleBounds - The time (in epochs) of the start and end of each NREM-REM cycle relative to lights off.
  • NREMsegs - a cell array where each entry contains the start and end (in epochs) of each NREM segment.
  • REMsegs - a cell array where each entry contains the start and end (in epochs) of each NREM segment.
  • CycleStats - The "NREM-REM Cycle Stats" table that shows the percentage of all the sleep stages in each NREM-REM cycle. Refer to the web output to see how this table is organized.
  • NREMperiodStats - The "NREM Period Stats" table that shows the percentage of all the sleep stages in each NREM period.
  • REMperiodStats - The "REM Period Stats" table that shows the percentage of all the sleep stages in each REM period.
  • CycleSummary - a vector containing the following entries:
    • The number of NREM-REM cycles
    • The number of REM periods
    • The mean number of segments per REM period
    • The standard deviation of REM segments per REM period
  • REMtoLsleep - The time (in minutes) between the last REM epoch and the last sleep epoch.
  • REMtoLon - The time (in minutes) between the last REM epoch and lights on.
  • transTableAll - The entire transition table. (This tells you how many times the subject's sleep transitioned from each stage to each other stage.)
  • transTableCollapse - The transition table with slow wave sleep collapsed across stage 3 and 4.

Statistics Definitions

All of the definitions for the statistics will be listed and updated at the bottom of the html output. The current definitions are:

SPT: sleep period time (elapsed time from sleep onset through last epoch of sleep).
TDT: Total dark time (elapsed time from lights out to lights on).
TST: Total sleep time (duration of time spent in Stages 1, 2, 3, 4 and REM during SPT).
NREM: Duration of time in Stages 1, 2, 3, 4.
SW: Slow wave sleep (Stages 3, 4).
All sleep tabulated from within SPT.
Sleep Onset:The time from the epoch of lights out until the first epoch of 3 contiguous epochs of sleep.
Wake After Sleep Onset: Wake time after sleep onset during SPT.
Wake After Final Awakening: Elapsed time spent awake between the final epoch of sleep and lights on.
Sleep Before Sleep Onset: Any transient sleep occurring between lights off and sleep onset.
All Stage Latencies: Elapsed time to first epoch of specified stage (from either lights off or sleep onset, as specified).
Quarters and Thirds: Calculated from SPT.

NREM-REM Cycle definitions per the modified criterion of Feinberg and Flyod (1979) as in Aeschbach and Borbély (1993).

NREM-REM Cycle: Succession of NREM period of at least 15 minutes duration by a REM period of at least 5 minutes duration.
No minimum duration for the first or last REM period.
NREM Period: Time interval between first occurance of Stage 2 and the first epoch of the next REM period.
REM Period: Time interval between two consecutive NREM periods or the between the last NREM period and final awakening.
NREM/REM Segments: Number of uninterrupted periods of NREM/REM during a NREM/REM period.

All other sleep statistics per:
Carskadon, MA, Rechtschaffen, A. Monitoring and Staging Human Sleep. In: Principles and Practices of Sleep Medicine 4th Edition, pgs. 1359-1377. Ed: Kryger, MH, Roth, T, Dement, WC. Philadelphia, PA : Elsevier Saunders, 2005.

Batch Sleep Statistics

If you want to run statistics on a whole group of subjects without opening the sleepSMG interface, you can use plotSleepStats to run the statistics from matlab and make a batch script. You can also use the outname input argument of this function if you want to have customized names for each subject. This will replace the name "stageStats" with whatever you specify on all the plotSleepStats output files listed above.

In order to use plotSleepStats make sure that you have the YOURPATH/sleepsmg/stats directory added to your matlab path.

Here is the function definition for plotSleepStats:
stageStats = plotSleepStats(stageData, outname)
Inputs:

  • stageData - The stageData struct described here. This can either be the struct itself or the name of a file containing the struct.
  • outname - [optional] This is an alternative name to use for all of the plotSleepStats output files. The default name is "stageStats".
Output:
  • stageStats - The struct containing all of the statistics information described above.