CS 1173 Data visualization and analysis in Matlab Lab 6
Additional analysis of the sleep diary data
Objectives:
- Use vector indexing to select rows and columns from arrays.
- Practice using statistical tools and plots.
- Become familiar with sleep diary data for the project.
- Handle more realistic data.
- Interpret data and draw conclusions.
|
 |
Hand-in Requirements:
- The
lab6Script.m script containing your work for all parts.
- The published script in the same directory.
All projects and laboratories should be submitted submitted electronically through
Blackboard under the Assignments menu. Zip up your entire lab6 directory
to submit. (Right click on the project folder and follow the Send To link.)
Overview
This laboratory examines the sleep diaries of the cohort as a whole.
Description of the data
The data for this semester can be found on Blackboard in the file diaryFall2011.mat.
This file is similar in format to the diary.mat file of Lesson 10 and Lab 5. However, it contains
the actual data from students of this semester.
bedTimes - array of bed times in decimal-date format.
dayCaffeine - array of daytime caffeine indicators.
gender - vector of male/female gender designators.
nightCaffeine - array of evening caffeine indicators.
section - vector of section indicators. The possible section
numbers are 0, 1, 2 and 3. Section 0 contains only a single
instructor. The remaining section numbers correspond to the actual
course section numbers.
toSleepMinutes - an array of number of minutes to fall asleep.
useAlarm - array of alarm use indicators.
wakeTimes - array of wakeup times in decimal-date format.
minutesNap - array of number of minutes of nap for each person on each day
timesAwake - array of the number of times each person woke up during the night
The arrays have a column for each person.
The vectors have an element for each person. The values
in column n correspond to the same person as the value in position
n of each vector. The individual in position n = 1 is an instructor.
Part I: Initial set up
- Create a directory called
lab6 in Z:\working\MATLAB.
- Change your MATLAB working directory to be this directory.
- Download the
DiariesFall2011.mat from Blackboard. (This
data file is also used in the project.)
Part II: Analysis
Perform each of the following analyses by computing
- Does caffeine use affect how much sleep a person gets?
- Compute and output the average number of hours of sleep obtained by those who used some caffeine and by those who used no caffeine.
- Create a box plot comparing the hours of sleep for the two groups (side-by-side boxes).
- Use a t-test to compare the population averages for these two groups in order to answer the question.
- Write a short paragraph discussing the result.
- Do men use more caffeine than women?
- Compute and output the percentage of times women used caffeine and men used caffeine.
- Create an errorbar graph with two bars (one for men and one for women). Plot the SEM errorbars.
- Use a t-test to compare the population averages for these two groups in order to answer the question.
- Write a short paragraph discussing the result, its significance, and potential sources of error.
- Do people with early bedtimes get more sleep than those with later bedtimes?
- Compute and output the average hours of sleep received for those who go to bed before 11pm (e.g.) and those who go to bed after 11pm.
- Create and plot histograms (as line graphs) for the average hours of sleep received for those groups.
- Use a t-test to compare the population averages for these two groups in order to answer the question.
- Write a short paragraph discussing the result, its significance, and potential sources of error.
- Are there any visible statistical differences in the wake-up times and caffeine use among women in the 4 sections?:
Apply at least three tests and discuss the results.
Grading rubric (point values)
| Criterion |
Performance indicator
|
| Missing |
Needs improvement |
Needs a little improvement |
Meets expectations |
| Caffeine and sleep computations done |
0 |
1 |
2 |
3 |
| Caffeine and sleep discussion |
0 |
1 |
1.5 |
2 |
| Gender and caffeine computations done |
0 |
1 |
2 |
3 |
| Gender and caffeine discussion |
0 |
1 |
1.5 |
2 |
| Early versus late bedtimes computations |
0 |
1 |
2 |
3 |
| Early versus late bedtimes discussion |
0 |
1 |
1.5 |
2 |
| Gender/section differences computation |
0 |
1 |
2 |
3 |
| Gender/section differences discussion |
0 |
1 |
1.5 |
2 |
This laboratory was written by Kay A. Robbins
and Jianhua Ruan of the
University of Texas at San Antonio and last modified on 15-Nov-2011.
Please contact krobbins@cs.utsa.edu
with comments or suggestions. 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.