Basic Statistics for Data Science
By: Melis Kurum
Tags: Data Science, Descriptive Statistics, Statistics, Data Analysis

The aim of this article is to provide basic statistical knowledge for people who just got started in data science. Statistics plays a central role in data science; knowing the descriptive statistics and probability theories provide a deeper insight into data. In this article, I will be giving a general overview of basic statistical concepts you must certainly know in order to excel in data science.

Types of Data

1) Categorical Data

a) Nominal Data

They don’t have any quantitative value and are only used to label variables.

Examples: Gender, Zip Code, Blood Type, Eye Color

b) Ordinal Data

It involves an order between units however the distance between the points is not equal or measurable. It is usually used in survey questionnaires.

Examples: Likert Scales (Very happy — Happy — Neutral — Unhappy — Very Unhappy)

2) Continuous Data

c) Interval Data

There is an order between units and the distance between them is equal. It doesn’t have an absolute zero point, that is to say, zero doesn’t mean the absence of the quantity being measured.

Examples: Temperature, time, IQ test

d) Ratio Data

There is an order between units, the distance between them is equal, and it has an absolute zero point. Hence it cannot be negative.

Examples: Height, weight, duration

Measures of Central Tendency

Measures of Central Tendencies are single values that attempt to describe the whole set of data. Three main measures are the mode, the median, and the mean.

Mode: The most commonly occurring value. The advantage of using mode over the median and mean is that mode can be used both with categorical and numerical data.

Median: It is the ‘middle value’ of a distribution when the values have been arranged in ascending or descending order. In the case a distribution has an even number of values, the median is the mean of the two middle values. It is less affected by outliers. Hence, the median is usually preferred to use rather than mean when there are many outliers in a distribution.

Mean: It is the arithmetic average of a data set which can be found by adding all the values and dividing by the number of data points. Its limitation is that it is affected by outliers.

Measures of Dispersion

5 Number Summary & Box Plot

Box Plot

5 Number Summary is used in descriptive statistics to give an idea about the distribution of the observations and it is visualized with a box plot. 5 Number Summary consists of the minimum value, the lower quartile(Q1), the median(Q2), the upper quartile(Q3), and the maximum value. In other words, they are the 0th, 25th, 50th, 75th, 100th percentiles respectively. Each interval between the points contains 25% of the data. The box plot is useful as it shows the skewness of a data set. If the median is closer to the bottom of the box, it means the distribution is positively skewed(skewed right). And if it is closer to the top of the box, then the distribution is negatively skewed(skewed left).

Range: The difference between the maximum and minimum value.

Interquartile Range(IQR): It is the first quartile subtracted from the third quartile(Q3 — Q1). Therefore, it can be said that IQR is the amount of spread in the middle 50% of a dataset.

Outliers: An outlier is an observation that is abnormally distant from the rest of the observations. A value beyond an inner fence is called a mild outlier. And a value beyond an outer fence is called an extreme outlier.

lower inner fence: Q1–1.5*IQ

upper inner fence: Q3 + 1.5*IQ

lower outer fence: Q1–3*IQ

upper outer fence: Q3 + 3*IQ

Standard Deviation & Variance

Standard Deviation(σ) and variance( σ²) measures the spread of the data about the mean value.

Variance is calculated by taking the differences between each value and the mean, and then squaring the difference to make them positive, and dividing it by the number of the values.

Standard Deviation is the square root of the variance. It is always measured in the same units as the original data.

Correlation Coefficient & Covariance

Covariance shows us only the direction of the linear relationship between variables. However, the Correlation Coefficient shows both the direction and the strength of the relationship. For this reason, the correlation coefficient is preferred over covariance.