Statistics is a science of collecting, summarizing, representing, and
analyzing data in order to answer certain research questions. Also, for any
conclusions reached, a measure of reliability must be provided.
In this tutorial, we cover the following topics:
The mode is the value in the data which occurs most often. The mode is often used with categorical data – data whose values are labels for different possible categories. The mode can also be used with continuous quantitative data, in which case we use the methods calculus to obtain it.
Consider the data in the Table below.
Phone type | Number of sales |
---|---|
Samsung | 205 |
iPhone | 443 |
Google pixel | 191 |
Xiaomi | 328 |
Realme GT | 263 |
What is the mode of this data?
Solution: the mode is the phone type with the highest number sold, viz: iPhone.
Nb. The data in the table are categorical (i.e., qualitative).
A median of a dataset is a number which divides it into two equal halves: lower half and upper half.
When data is skewed, such as with income data, a better measure of center to report is the median. The median and the mean are two of three measures of center (the third being the mode); they are used with quantitative data, making them suited for a different purpose than the mode, which is often the reported measure of center for categorical data. When data is symmetric, then a better measure of center to report is the mean (or average) because it uses all the values in the data for its calculation: the median only uses the middle value(s) for its computation, hence making it more resistant to outliers than the mean, and thus making it a better measure of center when data is skewed. An outlier is an observation or value that does not follow the general pattern in the data, such as a value which is much larger or much smaller than the rest of the data values.
So, the presence of an outlier can pull the mean down or up than it would have been without the outlier.
A quiz consisting of five questions was taken by 100 students and the following Table displays the results. Find the median score.
Score/5 | Number of students |
---|---|
0 | 5 |
1 | 6 |
2 | 14 |
3 | 25 |
4 | 40 |
5 | 10 |
Solution: The median is the average of the two middle values: the values in the following
positions: 50th and 51st: obtained from the index formula:
, where
size of the sample.
= 50.5, which when rounded down
and up gives 50 and 51, respectively. We now create the following cumulative frequency table to help with the locations of
the 50th and 51st values in the data (after the data has been sorted from smallest to largest, or vice-versa (which was already the case for this question)).
Cumulative frequency is the running total of all the frequency up to and including the current frequency.
The first cumulative frequency is the same as the first frequency. Nb. Frequency here is the number of students
at each score level.
Score/5 | Number of students | Cumulative frequency |
---|---|---|
0 | 5 | 5 |
1 | 6 | 11 |
2 | 14 | 25 |
3 | 25 | 50 |
4 | 40 | 90 |
5 | 10 | 100 |
From the cumulative frequency column, we see that the 50th value is a score of 3 and
the 51st value is a score of 4. So, the median score is the average of 3 and 4: .
, when clearly specified, are numbers which divide the data into one hundred parts,
with the parts containing roughly the same number of observations. For example, a 70th percentile score on an exam
is a score which 70% of observations are below or equal to and 30% of observations are above it or equal to it.
The relative position of the th percentile is at the index: . If this index
is an exact integer, then the th percentile is the observation at that index. Otherwise, the index is
rounded down and up, and the average of the values at these indices would be the th percentile.
are a special case of percentiles: they divide the dataset into four parts, with each
part containing approximately the same number of observations. There are three quartiles, viz:
The first quartile, , is the same as the 25th percentile.
The second quartile, , is the same as the 50th percentile or median.
The third quartile, , is the same as the 75th percentile.
The th quartile is located at the index .
Find the five-number summary for the following data:
Solution: Sort the data from smallest to largest as follows:
lower half: -6, 0, 3, 4, 6;
upper half: 10, 20, 20, 72, 100;
So, the five-number summary is: .
The mean or average is a measure of center. It is calculated by adding up the observations in the data and then
dividing by the number of observations, if the variable is a discrete random variable.
The mean is also called the expected value. For a continuous random variable with probability density function (pdf) ,
A random variable has the following pdf.
Compute , the expected value of .
Solution: This is mixed random variable because there is probaboility mass at (this is the discrete part of
) and the random variable takes values in the intervals: [0, 1] and [1, 1.5] (this is the continuous part of )
The standard deviation of a random variable, , is how far, on average, a randomly sampled observation
falls below or above the mean. There are a number of ways to find the standard deviation, , for a random variable, ,
but we will use the following definition:
A random variable has the following frequency distribution.
Compute . What percentage of the observations are within one standard deviation of the mean?
Solution: We obtain the following additional column of relative frequencies (i.e., probabilities).
bounds for one std. dev. of the mean are: ,
so that the scores between 1.93 and 4.45 are: 2, 3, 4. Therefore, the percentage of observations with scores of
2, 3, or 4 is: 0.14 + .25 + .4 = 79%
Obs | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
---|---|---|---|---|---|---|---|---|---|---|---|---|
1.25 | 2.16 | 4.33 | 1.68 | 6.63 | 4.19 | 2.85 | 3.29 | 2.66 | 1.73 | 8.19 | 5.83 | |
2.1 | 3.08 | 2.81 | 1.72 | 5.91 | 2.26 | 4.07 | 4.11 | 3.41 | 2.68 | 7.33 | 8.25 | |
5.15 | 1.52 | 4.16 | 5.8 | 2.56 | 1.78 | 3.82 | 3.25 | 2.51 | 5.95 | 8.92 | 7.32 | |
1.34 | 1.96 | 3.17 | 4.14 | 2.22 | 1.88 | 2.19 | 4.92 | 2.63 | 4.73 | 7.21 | 5.93 | |
3.26 | 2.67 | 2.18 | 7.12 | 3.06 | .86 | 1.43 | 1.02 | 4.08 | 3.21 | 8.56 | 5.99 | |
1.4 | .86 | 1.09 | 2.84 | .96 | .81 | .23 | .14 | 1.46 | 1.1 | 2.92 | 1.22 |
Consider the table above, consisting five explanatory variables, , , , , and , and one response variable .
There are 12 observations (obs) in the data. An analyst claims that the variables and do not contribute significantly to predicting the
value of . Use the partial F-test to investigate this claim, with significance level.
Solution: We want to test whether the reduced model given byis better than the full model given bySo, the null and alternative hypoyheses are respectively:The test statistic is given by:where ,
number of explanatory variables removed from the full model = 2 (),
number of explanatory variables in the full model (= 5),
number of observations in the data set (= 12),
Using R (full result from R is shown below), we get the least-squares regression equations
for the reduced and full model to be respectively:
From the R output above, we see that the coefficients and are not significant, supporting
the analyst’s claim, hence we do not reject the null hypothesis.
Nb. If we had done this by hand, then we would have needed to compute the test statistic, ,
and then compared it to the critical value , which can be obtained from R using the following
F-distribution quantile command, with two degrees of freedom, one for the numerator (), and the other
for the denominator (): . It is a good
exercise to verify that , so that the we do not reject , and the explanatory
variables and do not signicantly contribute to the prediction of .