1 answer

For the following set of data, please find the mode, median, standard deviation a t-test: FEMALES: 1 Time: 225.620 Reaction:

Question:

For the following set of data, please find the mode, median, standard deviation a t-test:

FEMALES:
1 Time: 225.620 Reaction: 0.262
2 Time: 400.040 Reaction: 0.234
3 Time: 469.160 Reaction: 0.199
4 Time: 386.390 Reaction: 0.259
5 Time: 345.540 Reaction: 0.243
6 Time: 351.880 Reaction: 0.301
7 Time: 89.676 Reaction: 0.449
8 Time: 103.830 Reaction: 0.284
9 Time: 131.020 Reaction: 0.380
10 Time:  374.300 Reaction: 0.241
11 Time: 1009.800 Reaction: 0.246
12 Time: 173.780 Reaction: 1.268
13 Time: 109.810 Reaction: 0.704
14 Time: 646.820 Reaction: 0.334
15 Time: 575.440 Reaction: 5.668
16 Time: 380.100 Reaction: 0.745
17 Time: 97.995 Reaction: 0.375
18 Time: 83.701 Reaction: 0.989
19 Time 339.860 Reaction:1.433


Answers

#include<iostream>
#include<iomanip>
#include <fstream>
#include<cmath>
using namespace std;

// Function to sort array contents
void sort(double array[], int len)
{
// Loops till length of array
for(int r = 0; r < len; r++)
{
// Loops till length of array minus on times
for(int c = 0; c < len - 1; c++)
{
// Checks if the value of c index position of the array is greater than the
// value of c + 1 index position
if(array[c] > array[c + 1])
{
// Swapping process
double temp = array[c + 1];
array[c + 1] = array[c];
array[c] = temp;
}// End of if condition
}// End of inner for loop
}// End of outer for loop
}// End of function

// Function to calculate median
void median (double array[], int len)
{
// Calculate the median of middle number
// Checks if the length is odd
if(len % 2 != 0)
{
int temp = ((len + 1) / 2) -1;
// Displays the median
cout << "\n The median is " << array[temp] << endl;
}// End of if condition
// Otherwise it is even
else
{
// Displays the median
cout << "\n The median is "<< array[(len / 2) -1] << " and " << array[len / 2] << endl;
}// End of else
}// End of function

// Function to calculate and return median value
double mean (const double array[], int len)
{
double total;
// Loops till length of array
for(int c = 0; c < len; c++)
// Calculates the total
total += array[c];
// Returns the average
return total / len;
}// End of function

// Function to calculate mode
void mode (double freq[], const double array[], int len)
{
// Loops till length of array
for (int i = 0; i < len; i++)
{
//initialize each element to 0
freq[i] = 0;
int j = 0;
// Loops till j is less than i and array of i index position value is not equals to array of j index position value
while ((j < i) && (array[i] != array[j]))
// Checks if array of i index position value is not equals to array of j index position value
if (array[i] != array[j])
// Increase the j counter by one
j++;
// Increase the frequency of j index position by one
freq[j]++;
}// End of for loop

// Initialize the max repeat to zero
int iMaxRepeat = 0;
// Loops till length of array
for (int i = 1; i < len; i++)
{
// Checks if frequency of i index position is greater than frequency of iMaximumRepeat
if (freq[i] > freq[iMaxRepeat])
// Update the iMaxRepeat with i value
iMaxRepeat = i;
}// End of for loop
// Display the mode value
cout<< "\n The mode is: " << array[iMaxRepeat] << endl;
}// End of function

// Function to calculate standard deviation
void standarddeviation (double array[], int len, double mean)
{
// Initializes standarddeviation to zero
double standardDeviation = 0.0;
// Loops till length of array
for(int c = 0; c < len; ++c)
// Calculates the total of array c index position value minus mean to the power two
standardDeviation += pow(array[c] - mean, 2);
// Calculates, displays standard deviation
cout<< "\n Standard Deviation: "<< sqrt(standardDeviation / len);
}// End of function

// Function to display the array
void showarray (double array[], int len)
{
// Loops till length of array
for(int c = 0; c < len; c++)
{
// To display 40 numbers per line
// Checks if the counter value is divisible by 40 then print new line
if(c % 10 == 0)
cout<<endl;
// Otherwise display the numbers in same line
else
// Displays array c index position data
cout<<fixed<<setprecision(3)<<array[c]<<", ";
}// End of for loop
// Displays new line
cout<<endl;
}// End of function

// main function definition
int main()
{
// Creates an array for time
double Time[] = {225.620, 400.040, 469.160, 386.390, 345.540, 351.880, 89.676, 103.830, 131.020, 374.300,
1009.800, 173.780, 109.810, 646.820, 575.440, 380.100, 97.995, 83.701, 339.860};

// Creates an array for reaction
double Reaction[] = {0.262, 0.234, 0.199, 0.259, 0.243, 0.301, 0.449, 0.284, 0.380, 0.241, 0.246, 1.268,
0.704, 0.334, 5.668, 0.745, 0.375, 0.989, 1.433};

// Calculates the length of time and reaction
int lenTime = sizeof(Time)/ sizeof(Time[0]);
int lenReaction = sizeof(Reaction)/ sizeof(Reaction[0]);

// Creates a freq array for time and reaction
double frequencyTime[lenTime];
double frequencyReaction[lenReaction];

// To store mean result
double meanRes;

// Calls the function to sort the array
sort(Time, lenTime);
sort(Reaction, lenReaction);

cout<<"\n ******** Time Mode, Median, SD ******** ";
cout<<"\n Sorted Time array \n";
// Calls the function to display the array
showarray(Time, lenTime);

// Calls the function to calculate median
median(Time, lenTime);
// Calls the function to calculate mean
meanRes = mean(Time, lenTime);
cout<<"\n Mean = "<<meanRes;
// Calls the function to calculate mode
mode(frequencyTime, Time, lenTime);
// Calls the function to calculate standard deviation
standarddeviation(Time, lenTime, meanRes);

cout<<"\n ******** Reaction Mode, Median, SD ******** ";
cout<<"\n Sorted Reaction array \n";
// Calls the function to display the array
showarray(Reaction, lenReaction);

// Calls the function to calculate median
median(Reaction, lenReaction);
// Calls the function to calculate mean
meanRes = mean(Reaction, lenReaction);
cout<<"\n Mean = "<<meanRes;
// Calls the function to calculate mode
mode(frequencyReaction, Reaction, lenReaction);
// Calls the function to calculate standard deviation
standarddeviation(Reaction, lenReaction, meanRes);
return 0;
}// End of main function

Sample Output:

******** Time Mode, Median, SD ********
Sorted Time array

89.676, 97.995, 103.830, 109.810, 131.020, 173.780, 225.620, 339.860, 345.540,
374.300, 380.100, 386.390, 400.040, 469.160, 575.440, 646.820, 1009.800,

The median is 345.540

Mean = 331.303
The mode is: 83.701

Standard Deviation: 229.671
******** Reaction Mode, Median, SD ********
Sorted Reaction array

0.234, 0.241, 0.243, 0.246, 0.259, 0.262, 0.284, 0.301, 0.334,
0.380, 0.449, 0.704, 0.745, 0.989, 1.268, 1.433, 5.668,

The median is 0.334

Mean = 0.769
The mode is: 0.199

.

Similar Solved Questions

1 answer
HomeWork3 Deadline: Tuesday March 31st, 2019 Problem 1: [10 points] Draw the equivalent circuit o...
HomeWork3 Deadline: Tuesday March 31st, 2019 Problem 1: [10 points] Draw the equivalent circuit of separately excited, shunt, and series DC motors. Problem 2: [50 points A 50 hp, 250 V, 1200 rpm dc shunt motor shown in Figure 1 has an armature resistance of 1 Ω. Its field circuit has a total r...
1 answer
Choices: Greater than, less than, or equal Asteroids X, Y, and Z have equal mass of...
Choices: Greater than, less than, or equal Asteroids X, Y, and Z have equal mass of 5.0 kg each. They orbit around a planet with M-6.20E+24 kg. The orbits are in the plane of the paper and are drawn to scale. Im Lu In the statements below, TE is the total mechanical energy, KE is the kinetic energy...
1 answer
CAN YOU HELP ME WRITE A BUSINESS MEMO?
CAN YOU HELP ME WRITE A BUSINESS MEMO?...
1 answer
How do you simplify #(30-i)-(18+6i)+30i# and write the complex number in standard form?
How do you simplify #(30-i)-(18+6i)+30i# and write the complex number in standard form?...
1 answer
The SP Corporation makes 37,000 motors to be used in the production of its sewing machines....
The SP Corporation makes 37,000 motors to be used in the production of its sewing machines. The average cost per motor at this level of activity is: Direct materials $ 9.60 Direct labor $ 8.60 Variable manufacturing overhead $ 3.50 Fixed manufacturing overhead $ 4.45 An outside su...
1 answer
How do you find the vertex and intercepts for #y= 1/2x^2#?
How do you find the vertex and intercepts for #y= 1/2x^2#?...
1 answer
A flatbed truck is loaded with 7,000 pounds of bricks. How many tons of brick are on the truck?
A flatbed truck is loaded with 7,000 pounds of bricks. How many tons of brick are on the truck?...
1 answer
Points: 3 17) A hot air balloon is descending at a rate of 3.0 m/s when...
Points: 3 17) A hot air balloon is descending at a rate of 3.0 m/s when a passenger drops a camera. If the camera is 45 m above the ground when it is dropped, how long does it take for the camera to reach the ground? Write your answer here Points: 2 18) The Moon has a mass of 7.35 x 1022 kg and the ...
1 answer
Garden Sales, Inc., sells garden supplies. Management is planning its cash needs for the second quarter....
Garden Sales, Inc., sells garden supplies. Management is planning its cash needs for the second quarter. The company usually has to borrow money during this quarter to support pealk sales of lawn care equipment, which occur during May. The following information has been assembled to assist in prepar...
1 answer
How can you convert a molecule with a chiral center into its mirror image?
How can you convert a molecule with a chiral center into its mirror image?...
1 answer
The poem "At the Lunch Counter" is by Alden Nowlan
the poem "At the Lunch Counter" is by Alden Nowlan. I am having difficulty understanding it. any help would be great....
1 answer
What is the missing reagent that can be used to carry out the following transformation? MgBr...
What is the missing reagent that can be used to carry out the following transformation? MgBr ? COOH A. H20 B. CO2 C. PCC D.K2Cr2O7, H2S04...
1 answer
What are the important components of an effective mission statement for a non-profit community health organization,...
What are the important components of an effective mission statement for a non-profit community health organization, How might these components differ for a for-profit organization?...
1 answer
Solve the transient heat conduction equation in the semi-infinite solid subjective to an isothermal boundary by using La...
solve the transient heat conduction equation in the semi-infinite solid subjective to an isothermal boundary by using Laplace transform...