Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please include the entire code you used in the answer!! thank you! Compose a C program (see attached pseudo-code) that performs the following tasks: 1)

Please include the entire code you used in the answer!! thank you!

Compose a C program (see attached pseudo-code) that performs the following tasks:

1) Reads in a set of N data points from a file consisting of one column of floating point data.

2) Computes the mean, variance, and skewness of the N data points using Equations (1-3). The program should calculate each of these three statistical descriptors by calling a separate function. Each function should be versatile enough to calculate the desired statistical descriptor for any number (N) of data points.

Equations 1-3:

image text in transcribed

3) Writes to a separate file the datas mean, variance, and skewness each on a separate line with appropriate message and units.

Use this program to find the mean, variance, and skewness of the resting systolic pressures (mmHg) and ages (years) of the 270 subjects stored in the file Age_sys_P.txt

Here is a the pseudo-code:

image text in transcribed

image text in transcribed

Here is a small portion of the Age_sys_P.txt:

7.000000000000000e+1 1.300000000000000e+2 6.700000000000000e+1 1.150000000000000e+2 5.700000000000000e+1 1.240000000000000e+2 6.400000000000000e+1 1.280000000000000e+2 7.400000000000000e+1 1.200000000000000e+2 6.500000000000000e+1 1.200000000000000e+2 5.600000000000000e+1 1.300000000000000e+2 5.900000000000000e+1 1.100000000000000e+2 6.000000000000000e+1 1.400000000000000e+2 6.300000000000000e+1 1.500000000000000e+2 5.900000000000000e+1 1.350000000000000e+2 5.300000000000000e+1 1.420000000000000e+2 4.400000000000000e+1 1.400000000000000e+2 6.100000000000000e+1 1.340000000000000e+2 5.700000000000000e+1 1.280000000000000e+2 7.100000000000000e+1 1.120000000000000e+2 4.600000000000000e+1 1.400000000000000e+2 5.300000000000000e+1 1.400000000000000e+2 6.400000000000000e+1 1.100000000000000e+2 4.000000000000000e+1 1.400000000000000e+2 6.700000000000000e+1 1.200000000000000e+2 4.800000000000000e+1 1.300000000000000e+2 4.300000000000000e+1 1.150000000000000e+2 4.700000000000000e+1 1.120000000000000e+2 5.400000000000000e+1 1.320000000000000e+2 4.800000000000000e+1 1.300000000000000e+2 4.600000000000000e+1 1.380000000000000e+2 5.100000000000000e+1 1.200000000000000e+2 5.800000000000000e+1 1.120000000000000e+2 7.100000000000000e+1 1.100000000000000e+2 5.700000000000000e+1 1.280000000000000e+2 6.600000000000000e+1 1.600000000000000e+2 3.700000000000000e+1 1.200000000000000e+2 5.900000000000000e+1 1.700000000000000e+2 5.000000000000000e+1 1.440000000000000e+2

The mean or arithmetic average of these N data points is a value about which the data points cluster and hence is a measure of the central tendency of the distribution of these data points N-1 The variance of the N data points is the average of the absolute values of the deviations of data points from the mean, and hence is a measure of data variability or scatter about the mean N -1 Variance -2- The skewness of the N data points is a measure of the degree to which the distribution of the data points about the mean value departs from symmetry N -1 Skewness m3 :- Pseudo-code for part ll: declare functions float fmean(float D, int) float fvariance(float I, int, float), float fskewn(float , int, float, float) main function declare variables/file pointers static float xdata[100], mean, var, skewn static int N; FILE *inputfile, *outputfile; Open data file in the read mode Prompt the user to enter number of points in data file Read number of data points N Use a for loop to read data from file and save it in array called xdata Call function fmean to calculate data mean Call function fvariance to calculate data variance Call function fskewn to calculate data skewness Prompt user to enter name of output file Open file in the write mode Write to the output file the calculated values of mean, variance, coefficient of variation, and skewness with appropriate messages and units float fmean(float xdatal, int N) float mean; use a for loop to calculate mearn return mean to main function float fvariance(float xdatal, int N, float mean) float variance; use a for loop to calculate data variance return variance to main function float fskewn (float xdatal, int N, float mean, float variance) float skewn; use a for loop to calculate data skewness return skewness to main function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

Why is an understanding of the process of motivation important?

Answered: 1 week ago