Project: Heart Health

Cholesterol, Heart Health, and Statistics

Heart health is a critical component of a sustainable and enjoyable human life. The human heart pumps and circulates blood throughout the body, so maintaining open and clear pathways (e.g. arteries) is essential to proper health. Cholesterol is one compound that can impede the body’s circulatory function. Cholesterol is found in all cells of the body, but an excess of cholesterol can have damaging effects on heart health. Individuals can maintain a healthy cholesterol level by eating a fiber-rich, low-fat diet and getting plenty of exercise, among other things.

Unhealthy cholesterol levels can lead to a variety of heart-related ailments, including arteriosclerosis. According the CDC, almost 3/4 of the U.S. population has what is considered “high cholesterol” and less than 1/3 have the condition under control. Risk factors for high cholesterol include a high-fat diet, excess body weight, and a family history of high cholesterol. Check out the following video for an further explanation of cholesterol and its effects on your system:

In this project, we will utilize statistics to examine a set of cholesterol data for a sample population. We will focus on two statistical tests often used to identify relationships between pairs of “variables” – i.e. data about individuals within a population. These two tests are:

  • The Independent Samples t-Test: This test is used to identify significant differences between groups, specifically between a dichotomous independent variable (one with only two possible values, e.g. gender) and a continuous dependent variable. For example, one question we could use a t-Test to help answer would be, is there a significant difference between men and women’s cholesterol readings for the given data?
  • The Pearson Correlation Coefficient (r): This test is used to identify whether two continuous variables are correlated, i.e. follow a similar pattern. For example, one question we could use a Pearson’s r-test to help answer would be, is there a correlation between an individual’s weight and their cholesterol reading, for the given data?

Information on the mathematics behind these statistics can be found in many introductory statistics textbooks and on the Web.

C++ Project: Statistical Heart Health

This project will provide you with an introduction to the fundamentals of one-dimensional arrays and user-defined functions in C++. In this project, you will…

  • Develop code to read data from the standard input and produce data to the standard output.
  • Write code that conforms to a programming style specified by the instructor.
  • Select and implement the appropriate control structure(s) for this problem.
  • Decompose the given problem into a sequence of single-purpose functions that are highly cohesive and loosely coupled.
  • Declare, define, and initialize one-dimensional, simple data type arrays of a fixed size.
  • Demonstrate the ability to read from and write to an arbitrary array element using array indices.
  • Demonstrate an ability to process the entire array, one element at a time, performing both read and write operations.
  • Develop code to read data from a text file and write data in a prescribed format to a text file.

As always, be sure to properly document your code. Consult the C++ Coding Guidelines document for proper coding standards. Use good design principles and design the solution before attempting to write code.

Create a program called Cholesterol.cpp. This program will take the following user input:

  • A filename (string)

Once the input is complete, your program should open the specified file and begin reading the data. The data is organized as a CSV file, with each line or “record” of data broken into four parts, separated by commas:

  • A gender (char, M or F)
  • A cholesterol reading (int)
  • A weight in pounds (int)
  • A flag about whether parents were diagnosed with high cholesterol, i.e. parental risk (char, Y or N)

The input does NOT need to be validated. Store the input values into a single array of a struct type (your design). Once the file is completely read, you will then compute a series of statistics and report them to the screen:

  • The number of records read from the file.
  • The number of records with a cholesterol reading greater than 160.
  • The results of a t-test to test for a relationship between gender and cholesterol reading. Be sure to report the standard error, the degrees of freedom, and the t-statistic.
  • The results of a t-test to test for a relationship between parental risk and cholesterol reading. Be sure to report the standard error, the degrees of freedom, and the t-statistic.
  • The results of a Pearson’s r calculation to determine if there is a correlation between weight and cholesterol reading. Be sure to report the r-statistic.

All computed numerical values should be precise to three decimal places. Your program should make use of multiple functions besides main() (use the input/process/output cycle as your guide). Think about how each problem actually involves more than one subproblem. At a minimum, you must construct functions aligned with the input-process-output steps.

A sample data file will be provided by the instructor.

Deliverables

See the instructor for submission instructions and due date(s).

Powered by WordPress. Designed by WooThemes

Skip to toolbar