Lab Assignment #3:
LAB Assignment #3: Measures of central tendency, dispersion and shape
Part I: Calculating the average molar mass on Mars. (10 pts)
The atmosphere on Mars is very different from the atmosphere on the Earth. Here is the
breakdown of Mars’ atmosphere composition:
Carbon dioxide 95.97%
Argon 1.93%
Nitrogen 1.89%
Oxygen 0.15%
Carbon monoxide 0.06%
Carbon dioxide, Argon, Nitrogen, Oxygen and Carbon monoxide have molar masses of 44 g/mol,
39 g/mol, 28 g/mol, 32 g/mol, and 28 g/mol separately. Please use MATLAB to calculate the
average molar mass (unit: g/mol) of the atmosphere on Mars. Write or attach your MATLAB
code/file.
1
GEOG 444 Lab Assignment #3:
Part II: Statistics on Missouri hydrology
Follow the following steps, and write a single MATLAB file with all the codes you used for your
calculations, name it as Missouri_Precip.m.
First download the MATLAB MAT-file, data.mat from Canvas, Week06, and save it in your
working directory. Load and read it in MATLAB. Make sure you will see a variable named data with
the size of 120×2. The first column presents the calendar year, from 1897 to 2016, and the second
column shows the annual (sum from January to December) precipitation (unit: inch) for each
corresponding year averaged over Missouri.
Let’s first define two variables: year, and precip. Then read in each column. Type “whos”, you
should be able to see the variables and sizes:
1) First calculate the measures of central tendency, namely, the mean and median of Missouri
precipitation during 1897-2016 in MATLAB, and name the variables Pmean, Pmedian. (1 pt
for each)
Pmean= Pmedian=
2) Calculate the maximum, minimum, range, average deviation, standard deviation values of
Missouri precipitation during 1897-2016. Name variables Pmax, Pmin, Prange, Pavgdev,
Pstd, Pvar. Then find out the corresponding years with maximum precipitation and
minimum precipitation using MATLAB command and name the years as yearmax and
yearmin separately. (1 pt for each)
Pmax= Pmin=
Prange= Pavgdev=
Pstd= Pvar=
yearmax= yearmin=
Calculate the 1st quartile, the 3rd quartile values and calculate the interquartile range (IQR)
values of Missouri precipitation during 1897-2016. If you do not have the statistics toolbox
(need to pay more $), please refer to slides 5-6 from Lecture note #11 to write your own
code to calculate it. You need to define a variable precip_sorted, to sort the precipitation
data from minimum value to maximum value. Then calculate the three values, and name
them 1stquartile value as precip1st, 3rd quartile as precip3rd, and precipIQR
precip1st = precip3rd= precipIQR=
3) Plotting: Let’s plot this time series (120years) using command “plot” to show the annual
precipitation of Missouri from 1897-2016, with x-axis as year and y-axis as precipitation in
unit of inches. Attach the plot. In this plot, use the following formatting: (8 pts)
o Use the plot command to plot the series with black color.
o Set the axis scaling for x-axis from 1897 to 2016, y-axis from 25 inches to 60 inches.
o Draw two horizontal lines: solid blue line to present the mean; dashed green line the
median.
2
GEOG 444 Lab Assignment #3:
o Highlight two years with maximum and minimum values of precipitation by putting
two red circles on the plot.
o Put a legend to present ‘each year’, ‘mean’, and ‘median’ separately.
o The x-axis should be labeled “Year”
o The y-axis should be labeled “annual precipitation (unit: inch)”
o Add major grid lines to the current axes
o Title should be “Missouri annual precipitation (1897-2016)”
4) Plotting: Plot the histogram of the precipitation data. Choose the bin as 25:2.5:60, use either
histogram or hist command. Attach the plot. (5 pts)
5) Calculate the skewness and kurtosis of the precipitation data and name them Pskewness and
Pkurtosis. Use the following formula in MATLAB: (4 pts)
and
Pskewness= Pkurtosis=
Is Missouri precipitation positive or negative skewed?
Is the peak sharper or flatter than a normal distribution curve? Recalling the kurtosis of a
normal distribution is the value of 3.
3