Micromasters
“SDS”
Module One
Introduction to Statistics and Data
-Dr. Fauwaz Parkar
1.1
Importance of Statistics in Data
Science
• - Understand and describe data
• - Make inferences and predictions
• - Identify relationships and patterns
• - Drive decisions using data
• Example:
• Average monthly sales = ₹45,000
• Prediction: Next month’s sales = ₹47,000
± ₹2,000
Types of Data – Overview
• - Categorical (Qualitative): Labels, e.g.,
City, Gender
• - Numerical (Quantitative): Discrete and
Continuous
• Examples:
• - Discrete: Number of cars
• - Continuous: Distance in km
Categorical Data – Pie Chart
Discrete Data – Bar Chart
Continuous Data – Scatter Plot
Levels of Measurement
• 1. Nominal: Labels (e.g., Gender)
• 2. Ordinal: Ordered (e.g., Poor to
Excellent)
• 3. Interval: Equal gaps (e.g., Temperature
°C)
• 4. Ratio: True zero (e.g., Salary)
Data Collection Techniques
• - Surveys: Questionnaires and forms
• - Observations: Watching and recording
• - Experiments: Controlled tests
• - Secondary Data: Using existing datasets
Sampling Techniques
• 1. Simple Random: Equal chance for all
• 2. Stratified: Sample from subgroups
• 3. Systematic: Every kᵗʰ element
• 4. Cluster: Randomly selected groups
Sampling – Numerical Example
• Population: 1,000 students
• Systematic Sampling with k=10
• Selected: 1st, 11th, 21st, ..., 991st
In short...
• - Statistics enables understanding and
prediction
• - Data types and measurement levels are
foundational
• - Visual tools (charts, plots) aid analysis
• - Sampling ensures reliable data insights
• Statistics is a tool for converting data into
information:
Statistics
Data Information
But where then does data come from? How is it
gathered? How do we ensure its accurate? Is the data
reliable? Is it representative of the population from
which it was drawn? This module explores some of
these issues.
5.12
Methods of Collecting Data…
• There are many methods used to collect
or obtain data for statistical analysis.
Three of the most popular methods are:
• Direct Observation
• Experiments, and
• Surveys.
5.13
5.14
5.15
5.16
5.17
5.18
5.19
5.20
5.21
5.22
5.23
5.24
5.25
5.26
5.27
5.28
5.29
5.30
5.31
5.33
5.34
5.40
5.46
5.51
Surveys…
• A survey solicits information from people; e.g. Gallup
polls; pre-election polls; marketing surveys.
• The Response Rate (i.e. the proportion of all people
selected who complete the survey) is a key survey
parameter.
• Surveys may be administered in a variety of ways, e.g.
• Personal Interview,
• Telephone Interview,
• Self Administered Questionnaire, and
• Internet
Questionnaire Design…
• Over the years, a lot of thought has been put into the
science of the design of survey questions. Key design
principles:
1. Keep the questionnaire as short as possible.
2. Ask short, simple, and clearly worded questions.
3. Start with demographic questions to help respondents
get started comfortably.
4. Use dichotomous (yes|no) and multiple choice
questions.
5. Use open-ended questions cautiously.
6. Avoid using leading-questions.
7. Pretest a questionnaire on a small number of people.
8. Think about the way you intend to use the collected
data when preparing the questionnaire.
Sampling…
• Recall that statistical inference permits us to draw
conclusions about a population based on a sample.
• Sampling (i.e. selecting a sub-set of a whole population)
is often done for reasons of cost (it’s less expensive to
sample 1,000 television viewers than 100 million TV
viewers) and practicality (e.g. performing a crash test
on every automobile produced is impractical).
• In any case, the sampled population and the target
population should be similar to one another.
Sampling Plans…
• A sampling plan is just a method or procedure for
specifying how a sample will be taken from a population.
• We will focus our attention on these three methods:
• Simple Random Sampling,
• Stratified Random Sampling, and
• Cluster Sampling.
• Random sampling,by far, is the most common one used.
Simple Random Sampling…
• A simple random sample is a sample selected
in such a way that every possible sample of the
same size is equally likely to be chosen.
• Drawing three names from a hat containing all
the names of the students in the class is an
example of a simple random sample: any group
of three names is as equally likely as picking any
other group of three names.
• VERY EASY TO DEFINE!
• VERY, VERY DIFFICULT TO DO!
• Random sample of 100 cokes bottles today at the coke plant.
• Random sample of 50 pine trees in a 1000 acre forest.
• Random sample of 5 deer in a national forest.
Simple Random Sampling…
• A government income tax auditor must choose a sample
of 5 of 11 returns to audit…[Can do many different ways]
Stratified Random Sampling…
• A stratified random sample is obtained by separating
the population into mutually exclusive sets, or strata, and
then drawing simple random samples from each stratum.
Strata 2 : Age Strata 3 : Occupation
Strata 1 : Gender < 20 professional
Male 20-30 clerical
Female 31-40 blue collar
41-50 other
51-60
> 60
We can acquire about the total population,
make inferences within a stratum
or make comparisons across strata
Stratified Random Sampling…
• After the population has been stratified, we can use simple
random sampling to generate the complete sample:
If we only have sufficient resources to sample 400 people total,
we would draw 100 of them from the low income group…
…if we are sampling 1000 people, we’d draw
50 of them from the high income group.
Cluster Sampling…
• A cluster sample is a simple random sample of groups
or clusters of elements (vs. a simple random sample of
individual objects).
• This method is useful when it is difficult or costly to
develop a complete list of the population members or
when the population elements are widely dispersed
geographically. Used more in the “old days”.
• Cluster sampling may increase sampling error due to
similarities among cluster members.
Sample Size…
• Numerical techniques for determining
sample sizes will be described later, but
suffice it to say that the larger the sample
size is, the more accurate we can expect
the sample estimates to be.
Sampling and Non-Sampling
Errors…
• Two major types of error can arise when a sample of
observations is taken from a population:
• sampling error and nonsampling error.
• Sampling error refers to differences between the
sample and the population that exist only because of the
observations that happened to be selected for the
sample. Random and we have no control over.
• Nonsampling errors are more serious and are due to
mistakes made in the acquisition of data or due to the
sample observations being selected improperly. Most
likely caused be poor planning, sloppy work, act of the
Goddess of Statistics, etc.
Sampling Error…
• Sampling error refers to differences between
the sample and the population that exist only
because of the observations that happened to
be selected for the sample.
• Increasing the sample size will reduce this type
of error.
Nonsampling Error…
• Nonsampling errors are more serious and are due to
mistakes made in the acquisition of data or due to the
sample observations being selected improperly. Three
types of nonsampling errors:
• Errors in data acquisition,
• Nonresponse errors, and
• Selection bias.
• Note: increasing the sample size will not reduce this
type of error.
Errors in data acquisition…
• …arises from the recording of incorrect
responses, due to:
• — incorrect measurements being taken because of faulty equipment,
• — mistakes made during transcription from primary sources,
• — inaccurate recording of data due to misinterpretation of terms, or
• — inaccurate responses to questions concerning sensitive issues.
Nonresponse Error…
• …refers to error (or bias) introduced when responses
are not obtained from some members of the sample, i.e.
the sample observations that are collected may not be
representative of the target population.
• As mentioned earlier, the Response Rate (i.e. the
proportion of all people selected who complete the
survey) is a key survey parameter and helps in the
understanding in the validity of the survey and sources of
nonresponse error.
Selection Bias…
• …occurs when the sampling plan is such that some
members of the target population cannot possibly be
selected for inclusion in the sample.
Sampling Numericals
Q1. How would you split a dataset of 10,000
customer reviews for sentiment analysis
using random sampling into training (70%),
validation (15%), and testing (15%) sets?
• A1. Training: 7000
• Validation: 1500
• Testing: 1500
Q2. In a classification dataset with 1200 cat
images and 800 dog images, how many of
each should be selected for a stratified
sample of 400 images?
• A2. Cats: 240
• Dogs: 160
Q3. If system logs are recorded every
second and total 90,000 entries, how many
entries would you get by sampling every
30th record (systematic sampling)?
• A3. 90,000 / 30 = 3000 records
Q4. From 50 edge devices generating 1000
readings each, if you randomly select 10
devices and use all their data (cluster
sampling), how many readings do you get?
• A4. 10 × 1000 = 10,000 readings
Q5. If training data from 2021 had 50%
gaming and 50% social media users, but
test data from 2025 has 80% gaming and
20% social media, what issue arises?
• A5. Sampling bias due to data drift – poor
model generalization
Q6. To estimate a 30% spam message rate
with 95% confidence and ±2% margin of
error, how many samples are needed?
• A6. Use formula: n = (Z² × p × (1 − p)) / E²
• Z = 1.96, p = 0.3, E = 0.02 → n ≈ 2018
Q7. In bootstrapping, if you generate 1000
samples (size 300 each) from a dataset of
300, how many unique samples are
expected in each bootstrap sample?
• A7. Approx. 300 × (1 − 1/e) ≈ 190 unique
samples
Q8. A city survey includes 1200 households
across 30 localities. You randomly choose 5
localities and survey all households there.
What sampling method is this?
• A8. Cluster Sampling – entire clusters
(localities) are selected and fully surveyed.
Q9. From a batch of 500 concrete cubes
tested, you want to select a representative
sample of 50 using systematic sampling.
What should be the interval?
• A9. Interval = 500 / 50 = every 10th cube
Q10. A production line manufactures 10,000
bolts daily. You inspect every 100th bolt for
quality. What sampling technique is this?
• A10. Systematic Sampling – every 100th
item is checked.
Q11. You want to assess machine wear from
500 machines, where 100 are randomly
selected and grouped by age for analysis.
What is this approach?
• A11. Stratified Random Sampling –
grouped (stratified) by machine age.
Q12. From a power plant with 200 sensors,
you want to select a representative sample
for maintenance analysis. You use a random
number generator to pick 40 sensors.
Identify the sampling type.
• A12. Simple Random Sampling
Q13. In a signal processing experiment, you
record 100,000 samples. You take every
500th sample to analyze signal stability.
What type of sampling is used?
• A13. Systematic Sampling – selecting at
regular intervals.