CS 1173 Data Analysis and Visualization Lab 4
Finding relationships in 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. Calculate and use an fprintf to output the following correlations in your sleep diary data. The first data element will be your variable X data (meaning it will be the first variable used in your function).
  2. You should create the following graphs: Note: You may find the handout Coding a best fit line useful if you would like to avoid manual editing of your graphs.
  3. 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
    Correlations were correctly computed and output 0 2.5 4 4.5 5
    Four histograms created and labeled 0 3.75 6 6.75 7.5
    Three scatter plots created and labeled with linear fit and correlation 0 3.75 6 6.75 7.5
    Line graphs using plot and plotyy or subplot 0 2.5 4 4.5 5
    The lab3Script contains all code and is published 0 2.5 4 4.5 5
    Bullet points on correlations and scatterplots 0 5 8 9 10
    Bullet points on other graphs 0 5 8 9 10

    This laboratory was last modified October 13, 2018. 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.