Question
In this lab you will use specific functions to determine the quartiles of a set of data. Quartiles of a set is defined as the
In this lab you will use specific functions to determine the quartiles of a set of data. Quartiles of a set is defined as the 25%, 50% and 75% values of the dataset.
We can intepret this to mean the following:
In a sorted data set, the 25% value separates the lowest 25% of the set from the upper 75% of the set. The 50% value separates the lowest 50% of the set from the upper 50% of the set (often called the median). The 75% value separates the lower 75% from the upper 25% of the set.
If we think about how to calculate quartiles we could:
Find the median of the set
Separate out the set into two smaller sets
Find the medians of the smaller two sets
Load the Data
Your first task is to load a dataset from the file "mayoralpayroll.mat". Inside this file is a 177x5 array named payInfo containing salaries (among other things) of all the people working in the Mayor of LA's office (including the mayor). In the fourth column is the annual salary of all the employees.
NOTE: The annual salaries are already sorted in ascending order
Your job is to determine the quartiles of the annual salary and store it in a vector named salaryQuartiles
Find the Median
Using whatever method you'd like, find the median of the annual salaries. Since the dataset is 177 elements long, we know the median is the value in the middle. This is the 50% value.
Split the Set
Once you find the median value, split the data set into two separate data sets that do not include the median value. Again, use whatever method you'd like to find the median of the two data sets. This represents the 25% value (median of the lower set) and the 75% value (the median of the upper set).
Merge the Results
Store all the final values into a single vector named salaryQuartiles
NOTE: You may not use the quantiles(), prctile(), or iqr() functions
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started