Descriptive Statistics Study Guide
Data Fundamentals and Structure
Tabular Data Representation:
Data is organized into rows and columns, similar to spreadsheets in Excel or Google Sheets.
Observations (): Represented by individual rows in a dataset. An observation is also referred to as an experimental unit.
Variables (): Represented by individual columns in a dataset, corresponding to specific attributes or features measured across observations.
Celebrity Dataset Example:
The dataset contains observations () and variables:
Observation : Celebrity Name = Tom Cruise, Height = \,inches, Married = N, Sex = M, Age =
Observation : Celebrity Name = Zendaya, Height = \,inches, Married = N, Sex = F, Age =
Observation : Celebrity Name = Tom Holland, Height = \,inches, Married = N, Sex = M, Age =
Observation : Celebrity Name = Natalie Portman, Height = \,inches, Married = Y, Sex = F, Age =

Statistic Definition:
A statistic summarizes a variable in data across each observation.
Example: Calculating the average height across the four celebrities yields \,inches.
Branches of Statistics
Descriptive Statistics:
Focuses on describing the "what" within the data ("in-sample").
Summarizes data using meaningful mathematical measures, summary tables, and charts.
Inferential Statistics:
Focuses on making claims or predictions based on data ("out-of-sample").
Draws inferences from a sample to an entire underlying population.
Requires probability models and deeper statistical theory.
Visualizations and Summaries for Data Description
Summary Tables: Summarize statistics across categorized dimensions.
Graphical Charts and Visualization Types:
Bar Plot: Used to summarize counts or percentages for discrete groups or categories.
Pie Chart: Used to summarize the percentage of total belonging to each category within a single variable.
Histogram: Displays frequency distributions for continuous variables. Serves as the primary visualization method when analyzing a single quantitative variable.
Line Chart: Used to track variables over time (time-series analysis).



Key Properties of Data Distributions:
Domain: The span of input values along the horizontal axis ( axis).
Range: The span of frequencies or counts along the vertical axis ( axis).
Central Tendency (Center): Middle points such as median or mode.
Variability / Dispersion: Spread around the center, such as variance or standard deviation.
Shape: Symmetry, peakness, and skewness of the distribution.
R Code Example for Data Generation and Plotting:
set.seed(123)
data <- rnorm(n=1000, mean=0, sd=1)
hist(data)
* *Properties of generated dataset:* varies from to (domain), varies from to (range), median and mode are centered at , skewness is approximately (roughly equal data on left and right sides).

Measures of Location (Central Tendency)
Measures of location identify the center or typical value of a dataset. There are five main measures of location:
Midrange:
Definition: The midpoint value halfway between the maximum and minimum observations.
Formula:
R Functions:
(min(x) + max(x)) / 2Pros: Simple to compute; does not require the complete dataset.
Cons: Utilizes only two observations; highly sensitive to extreme values or outliers.
Mode:
Definition: The most frequently occurring value in the dataset.
R Function:
mfv(x)from themodeestpackage.Pros: Intuitive to interpret; completely unaffected by extreme outliers.
Cons: A unique mode may not exist, or multiple modes may exist; may not accurately reflect the center of continuous distributions.
Median:
Definition: The middlemost observation when data points are arranged in ascending order.
R Function:
median(x)Pros: Insensitive to extreme outliers; represents the typical experience.
Cons: Ignores specific values of observations other than the middle positioning.
Mean:
Definition: The arithmetic average of all observations in the sample or population.
Formulas:
Sample Mean: \bar{x} = \frac{\text{sum}(x_i)}{n} = \frac{\text{\sum} x_i}{n}
Population Mean: \text{\mu} = \frac{\text{\sum} x_i}{N}
R Function:
mean(x)Pros: The most widely used measure of central tendency; incorporates all data points.
Cons: Highly sensitive to extreme values and skewness.
Trimmed Mean:
Definition: The mean calculated after discarding a specified percentage of extreme values from both the top and bottom of the sorted dataset.
R Function:
mean(x, trim = 0.2)(e.g., dropping the outer on each side to keep the central ; dropping top/bottom to keep middle is standard in practice).Pros: Retains the comprehensive nature of the mean while eliminating the distorting impact of outliers.

Impact of Skewed Data on Central Tendency:
Extreme outliers pull the mean away from the median toward the tail.
Real-World Example: If Michael Jordan (net worth \text{\\$3.5\,billion}) enters a room of Geography graduates from UNC-Chapel Hill, the mean graduating salary increases dramatically, falsely implying an extremely high typical earnings level, whereas the median remains stable and accurate.

Detailed Example — Target Daily Sales ( days):
Dataset ( in thousands of dollars):
Midrange Calculation:
Mode Calculation: Most frequent value is
Median Calculation: observation in ordered sequence =
Mean Calculation: \text{\sum} x_i = 392 \n \rightarrow \bar{x} = \frac{392}{11} = 35.63636
Trimmed Mean Calculation ( trim): Removes lower ( values: ) and upper ( values: ). Mean of remaining values () is .
R Execution Script and Output for Target Daily Sales:
dailysls <- c(17, 23, 29, 33, 37, 37, 37, 40, 42, 48, 49)
library(modeest)
(min(dailysls) + max(dailysls)) / 2 # [1] 33
mfv(dailysls) # [1] 37
median(dailysls) # [1] 37
mean(dailysls) # [1] 35.63636
mean(dailysls, trim = 0.2) # [1] 36.42857
Practice Problem — Employee Training Hours:
Dataset ( reports):
Ordered Dataset:
Midrange:
Mode:
Median:
Mean:
Trimmed Mean ( trim / dropping top and bottom observation):
Evaluation: The outlier (\,hours) severely inflates the midrange () and mean (). The median (\,hours) or trimmed mean (\,hours) best describes the true center of employee training hours.
Measures of Variability (Dispersion)
Measures of variability quantify the spread, dispersion, or scatter of observations around the center. There are five primary measures:
Range:
Definition: Total distance between maximum and minimum observations.
Formula:
Pros: Straightforward to calculate.
Cons: Uses only two observations; extremely vulnerable to outliers.
Interquartile Range (IQR):
Definition: Distance between upper quartile ( or percentile) and lower quartile ( or percentile).
Formula:
R Functions:
quantile(x, 0.75) - quantile(x, 0.25)Pros: Measures spread of the middle of data; unaffected by extreme outliers.
Cons: Discards half of the dataset information.
Variance:
Definition: The average squared deviation of observations from their mean.
Population Variance Formula: \text{\sigma}^2 = \frac{\text{\sum} (x_i - \text{\mu})^2}{N}
Sample Variance Formula: s^2 = \frac{\text{\sum} (x_i - \bar{x})^2}{n - 1}
R Function:
var(x)Pros: Mathematically tractable, utilizes all observations.
Cons: Measured in squared units of the original variable, making direct intuitive interpretation difficult.
Standard Deviation:
Definition: The standard/average distance that data points deviate from the mean.
Population Standard Deviation Formula: \text{\sigma} = \text{\sqrt{\sigma^2}} = \text{\sqrt{\frac{\sum (x_i - \mu)^2}{N}}}
Sample Standard Deviation Formula: s = \text{\sqrt{s^2}} = \text{\sqrt{\frac{\sum (x_i - \bar{x})^2}{n - 1}}}
Sample Calculation Shortcut Formula: s = \text{\sqrt{\frac{\sum x_i^2 - \frac{(\sum x_i)^2}{n}}{n - 1}}}
R Function:
sd(x)Pros: Expressed in the exact same measurement units as the raw data; standard metric in statistics.
Cons: Sensitive to extreme outliers.
Coefficient of Variation (CV):
Definition: Ratio of standard deviation to the mean, measuring relative variability as a percentage.
Formulas:
Sample CV:
Population CV: \text{CV} = \frac{\text{\sigma}}{\text{\mu}}
Pros: Unitless measure; allows direct comparison of variability across variables measured in different units or with drastically different mean magnitudes.
Cons: Sensitive to extreme outliers; meaningless if mean is zero or close to zero.

Step-by-Step Hand Calculation Table for Target Daily Sales ():
Dataset (\text{thous}\):
Mean:
Daily Sales () | Deviation () | Squared Deviation () | Squared Value () |
|---|---|---|---|
Sum: | Sum: | Sum: | Sum: |
Sample Variance Computation:
Sample Standard Deviation Computation: s = \text{\sqrt{95.45454545}} = 9.770084
Shortcut Formula Verification: s = \text{\sqrt{\frac{14924 - \frac{(392)^2}{11}}{10}}} = \text{\sqrt{\frac{14924 - 13969.454545}{10}}} = \text{\sqrt{\frac{954.5454545}{10}}} = 9.770084

Verbal Descriptions of Dispersion Measures:
Standard Deviation in words: Target daily sales for \,days varies an average of \,thousands of dollars away from the mean of \,thousands of dollars.
Coefficient of Variation Computation:
Coefficient of Variation in words: Target daily sales for a sample of \,days varies an average of away from the mean of \,thousands of dollars.
R Script and Output for Variability Measures:
dailysls <- c(17, 23, 29, 33, 37, 37, 37, 40, 42, 48, 49)
rang <- max(dailysls) - min(dailysls) # [1] 32
quantile(dailysls, 0.75) # 75% : 41
quantile(dailysls, 0.25) # 25% : 31
IQR <- quantile(dailysls, 0.75) - quantile(dailysls, 0.25) # 10
var(dailysls) # [1] 95.45455
sd(dailysls) # [1] 9.770084
cv <- sd(dailysls) / mean(dailysls) # [1] 0.2741605
hist(dailysls, breaks = 3) # Shows slight left-skewness

Practice Problem — Sales Territory Comparison (Metro vs. Rural):
Metropolitan Areas (): ,
Rural Areas (): ,
Metro Standard Deviation in words: Metro area sales vary an average of \,thousand away from the mean sales of \,thousand.
Metro Coefficient of Variation:
Rural Coefficient of Variation:
Metro Coefficient of Variation in words: Metro area sales vary an average of away from the mean sales of \,thousand.
Relative Variability Evaluation: Metropolitan territories have lower relative variability ( vs. ), even though their absolute standard deviation is higher ( vs. ).
Distribution Shape and Skewness
Skewness Types:
Left-Skewed (Negative Skew): Tail extends to the left toward smaller values; mean is pulled below the median.
Symmetric (No Skew): Left and right halves are mirror images; mean equals median equals mode.
Right-Skewed (Positive Skew): Tail extends to the right toward larger values; mean is pulled above the median.



Analytical Implications of Skewness:
When skewness or extreme outliers exist, metrics like the mean and standard deviation become distorted.
In skewed distributions, reporting median and interquartile range (IQR) or using a trimmed mean is preferred.
Adjusting Histogram Binning in R:
Default plot command:
hist(dailysls)Specifying bin intervals:
hist(dailysls, breaks = 3)


Measures of Relative Standing and Data Standardization
Quartiles:
( percentile) and ( percentile) act as boundary thresholds dividing the data into quarters.
Can be visually represented using box plots.
-Scores (Standardization):
Definition: Measures how many standard deviations an observation lies above or below the mean.
Population Formula: z = \frac{x_i - \text{\mu}}{\text{\sigma}}
Sample Formula:
Example Calculation: Given height with mean \text{\mu} = 68\,inches and standard deviation \text{\sigma} = 3\,inches, the -score for a height of \,inches is . This height is standard deviations below the average.

Empirical Rule (68-95-99.7 Rule):
Applies strictly to symmetric, bell-shaped (mound-shaped) distributions.
of observations lie within standard deviation of the mean (\text{\mu} \pm 1\text{\sigma} or ).
of observations lie within standard deviations of the mean (\text{\mu} \pm 2\text{\sigma} or ).
of observations lie within standard deviations of the mean (\text{\mu} \pm 3\text{\sigma} or ).


Detecting Outliers:
Outliers are extreme data points inconsistent with the main body of data.
-Score Threshold Rules:
( or ): Considered a possible outlier.
( or ): Considered a definite outlier.
Example Evaluation: A -score of is classified as a possible outlier, but not a definite outlier.
Outliers can also be identified visually via box plots.
Data Importation Procedures in RStudio
GUI / Manual Method:
Navigate to the Environment Pane in RStudio.
Click Import Dataset.
For
.csvfiles: Select From Text (base).For
.xlsor.xlsxfiles: Select From Excel.

Programmatic / Script Method:
Set working directory dynamically to script path:
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
* Importing `.csv` file:
mydata <- read.csv("filename.csv")
* Importing `.xlsx` file:
library(readxl)
mydata <- read_excel("filename.xlsx")