CS 1173 Data Analysis and Visualization Lab 3
Basic statistics of your sleep diary data

Objectives:

  • Practice using statistical tools and plots.
  • Become familiar with sleep diary data for the project.
  • Handle more realistic data.
  • Interpret data and draw conclusions.
EEG of slow wave or N3 sleep

Hand-in Requirements:

All projects and laboratories should be submitted submitted electronically through Blackboard under the Assignments menu. Zip up your entire lab3 directory to submit. (Right click on the project folder and follow the Send To link.)

 

Overview

This laboratory examines your sleep patterns as recorded in your sleep diary.

 

Description of the data

File Description
Last_First_gender.mat Your sleep diary file contains the following fields in a structure called diary:

  • bedTimes - bed times in decimal-date format (vector)
  • dayCaffeine - daytime caffeine indicators (vector)
  • nightCaffeine - evening caffeine indicators (vector)
  • toSleepMinutes - number of minutes to fall asleep (vector)
  • useAlarm - alarm use indicators (vector)
  • wakeTimes - wakeup times in decimal-date format (vector)
  • lastName - your last name
  • firstName - your first name
  • gender - 'male' or 'female'
  • section - your section number (vector)
  • minutesNap - number of minutes of napping (vector)
  • minsAwake - number of times awakened each night (vector)
  • SSI - Stanford Sleepiness Scale (or Index)

Structures are used to keep variables in a group. To access your bedtimes, for example, you would use diary.bedTimes. If you wanted a separate variable for your bed times, you would do:

   myBedTimes = diary.bedTimes;

If you did not do a sleep diary, you will have to make up some data, enter it into the Excel spreadsheet and run the test scripts.

The bedtimes and wake-up times use MATLAB's decimal date format. The date is a number representing the offset from 0:00 of a particular reference day. The integer part of this value represents the day and the fractional part represents the fraction of 24 hours represented by the hour and minutes. Use the datestr function to convert the decimal value to a string for printing or viewing.

To properly handle times, you will convert time in decimal-date format to time in hours using the fractional part and ignoring the day part. Each time-hour will be relative to the day recorded in the sleep diary.

Example 1:The wake-up time 6:00 am on 9/23/2009 has the decimal date value of 734039.25. The 0.25 represents 6/24 fraction of a day. The time-hour would be 6.0

Example 2:The decimal date of 9/22/2009 at 9:00 pm is 734038.875. If the day of the recording was 9/23, 734038.875 - 734039 = -0.125 represents 3/24 hours before midnight of the previous day. The time-hour would be -3.0

Example 3:The decimal date of 9/23/2009 at 5:49 am is 734039.242361111. The fraction 0.242361111 can be calculated as (5 + 49/60)/24. The time-hr would be 5.817

Part I: Initial set up

Part II: Data analysis requirements:

In this project you should analyze your sleep characteristics using the statistical and graphical tools covered in class. Your script should calculate and output the following:
  1. You should calculate and output the basic statistical indicators for your individual diary (maximum, minimum, mean, median, standard deviation, AAD and MAD) of: Your output should be in tabular format (use %#.#f to line up the columns) with the names of the variables (e.g., wake-up time, etc.) in the left most column. Label the columns with the names of the indicators (e.g., Maximum, etc.).
  2. You should calculate and output:
  3. You should create the following graphs:

    Part III: Publish the results

    Publish your script by pushing the Publish icon. Make sure that your script is separated appropriately into cells and that each cell has a title indicating what is computed in that cell.

    Analysis

    Grading rubric (point values)

    Criterion
    Performance indicator
    Missing Needs improvement Needs a little improvement Meets expectations Excellent
    Statistical indicators correctly computed and presented in tabular form 0 5 8 9 10
    Percentages computed 0 3.75 6 6.75 7.5
    Four errorbar graphs correctly labeled 0 3.75 6 6.75 7.5
    The lab2Script contains all code and is published 0 2.5 4 4.5 5
    Bullet points on statistics 0 5 8 9 10
    Bullet points on graphs 0 5 8 9 10

    This laboratory was last modified 08-Aug-2016. The image is a screen shot of 30 seconds of an EEG recording of a patient during Slow Wave Sleep. The photograph was taken by S. S. Jähnichen on 12/9/2005. The image is available on Wikipedia as http://en.wikipedia.org/wiki/File:Sleep_EEG_Stage_4.jpg.