You are on page 1of 24

Applied Statistic For Machine Learning

Second Session

Ehsan Maminejad

Feb 2021
Outline
▪ Intro to R
▪ Random Variables
▪ Sampling Methods
▪ Review of some concepts
▪ Sampling Distribution
▪ Central Limit Theorem
▪ Example1 / Bootstraping
▪ More on Normal Distribution and QQ-Plot
▪ Student’s t-Distribution
▪ Example2 / Confidence Interval
2
Applied Statistic For Machine Learning - Ehsan Maminejad
Intro to R

3
Applied Statistic For Machine Learning - Ehsan Maminejad
Random Variables:
▪ Variable: Because x can take on a set of values, it’s a variable.

▪ Random Variable: Because x’s possible values correspond to the elementary outcomes of an
experiment (meaning you can’t predict its values with absolute certainty), x is called a random
variable.

▪ Examples:

Discrete: die tossing

Continues: Temperature

4
Applied Statistic For Machine Learning - Ehsan Maminejad
Sampling Methods:

)Probability Sampling(‌‫نمونه‌گیری‌تصادفی‬ ▪
)Simple Random Sample(‌‫نمونه‌گیری‌تصادفی‌ساده‬ ▪
)Systematic Sampling(‌‫نمونه‌گیری‌سیستماتیک‬ ▪
)Stratified Sampling(‫نمونه‌گیری‌طبقه‌ای‬ ▪
)Cluster Sampling(‫نمونه‌گیری‌خوشه‌ای‬ ▪

5
Applied Statistic For Machine Learning - Ehsan Maminejad
‫‪Sampling Methods:‬‬
‫نمونه‌گیری تصادفی ساده (‪ :)Simple Random Sample‬در نمونه‌گیری تصادفی ساده‪ ،‬همه اعضای جامعه آماری شانسی‬ ‫▪‬
‫برابر برای انتخاب شدن در نمونه را دارند‪ .‬در این حالت جامعه آماری یکپارچه است و قابل تفکیک به بخش‌های مختلف‬
‫نیست‪.‬‬

‫‪6‬‬
‫‪Applied Statistic For Machine Learning - Ehsan Maminejad‬‬
‫‪Sampling Methods:‬‬
‫نمونه‌گیری سیستماتیک(‪ :)Systematic Sampling‬اگر جامعه آماری را بتوان براساس یک ویژگی مرتب کرد‪ ،‬می‌توان از‬ ‫▪‬
‫نمونه‌گیری سیستماتیک بهره گرفت‪ .‬انتخاب اعضای نمونه در این شیوه‪ ،‬با استفاده از یک مقدار تصادفی و همچنین مقداری‬
‫به عنوان فاصله اعضا صورت می‌گیرد‪.‬‬

‫𝑒𝑧𝑖𝑆 𝑛𝑜𝑖𝑡𝑎𝑙𝑢𝑝𝑜𝑃‬
‫=𝐾‬
‫𝑒𝑧𝑖𝑆 𝑒𝑙𝑝𝑚𝑎𝑆‬

‫‪7‬‬
‫‪Applied Statistic For Machine Learning - Ehsan Maminejad‬‬
‫‪Sampling Methods:‬‬
‫نمونه‌گیری طبقه‌ای(‪ :)Stratified Sampling‬در حالتی که جامعه آماری دارای بخش‌های مجزایی باشد‪ ،‬می‌توان محدوده‬ ‫▪‬
‫نمونه‌گیری را به بخش‌های مختلف تقسیم کرد‪ .‬در این حالت هر بخش از جامعه به عنوان یک زیرجامعه تلقی شده که‬
‫نسبت به بقیه بخش‌ها مستقل است‪ .‬به این ترتیب با استفاده از نمونه‌گیری تصادفی از هر زیربخش به یک نمونه کامل‬
‫خواهیم رسید‪.‬‬

‫‪8‬‬
‫‪Applied Statistic For Machine Learning - Ehsan Maminejad‬‬
‫‪Sampling Methods:‬‬
‫نمونه‌گیری خوشه‌ای(‪ :)Cluster Sampling‬گاهی برای نمونه‌گیری از جامعه‌ای که اعضای آن در گروه‌هایی مجزا قرار دارند‪،‬‬ ‫▪‬
‫از روش نمونه‌گیری خوشه‌ای استفاده می‌شود‪ .‬این شیوه معموال براساس بخش‌های مجزایی که توسط نواحی جغرافیایی‬
‫تعیین می‌شوند به کار می‌رود‪.‬‬

‫‪9‬‬
‫‪Applied Statistic For Machine Learning - Ehsan Maminejad‬‬
Sampling Methods:

)Non-Probability Sampling(‌‫نمونه‌گیری‌غیرتصادفی‬ ▪
‫نمونه‌گیری‌گلوله‌برفی‬ ▪
‫نمونه‌گیری‌اتفاقی‬ ▪
‫نمونه‌گیری‌متوالی‬ ▪
‫نمونه‌گیری‌قضاوتی‬ ▪

10
Applied Statistic For Machine Learning - Ehsan Maminejad
‫‪Sampling Methods:‬‬
‫تعیین‌حجم‌نمونه‬ ‫▪‬

‫تعیین‌اندازه‌نمونه‌بر‌اساس‌جدول‌های‌آماده‬ ‫▪‬

‫جدول‌نمونه‌گیری‌مورگان‬ ‫▪‬

‫تعیین‌حجم‌نمونه‌بر‌اساس‌نظر‌پژوهش‌گر‬ ‫▪‬

‫حداقل‌اندازه‌نمونه‌را‌‪ ۱۰‬درصد‌اندازه‌جامعه‬ ‫▪‬

‫تعیین‌اندازه‌نمونه‌بر‌اساس‌محاسبات‌آماری‬ ‫▪‬

‫تعیین‌اندازه‌نمونه‌با‌فرمول‌کوکران‬ ‫▪‬

‫‪11‬‬
‫‪Applied Statistic For Machine Learning - Ehsan Maminejad‬‬
Review of Some Concepts:

N )Population(‌‫جمعیت‌آماری‬ ▪

n )Sample(‌‫نمونه‌آماری‬ ▪

)Parameter(‌‫پارامتر‌جامعه‬ ▪

)Statistics(‌‫آماره‬ ▪

12
Applied Statistic For Machine Learning - Ehsan Maminejad
Review of Some Concepts:
‫پارامتر‬ ‫آماره‬

𝜇 𝑋ത

𝜎2 𝑆2

𝜇1 − 𝜇2 𝑋ത1 − 𝑋ത2

13
Applied Statistic For Machine Learning - Ehsan Maminejad
Sampling Distribution:
▪ In general, a sampling distribution is the distribution
of all possible values of a statistic for a given sample
size.

▪ Sample Statistic:
A metric calculated for a sample of data drawn from a
larger population.

▪ Data distribution:
The frequency distribution of individual values in a data set.

▪ Sampling distribution:
The frequency distribution of a sample statistic over many
samples or resamples.

14
Applied Statistic For Machine Learning - Ehsan Maminejad
Central Limit Theorem:
According to the central limit theorem:

▪ The sampling distribution of the mean is approximately a normal distribution if the sample size is
large enough. Large enough means about 30 or more.

▪ The mean of the sampling distribution of the mean is the same as the population mean. In equation
form, that’s:
𝑥ҧ = 𝜇 or 𝜇𝑥ҧ = 𝜇

▪ The mean of the sampling distribution of the mean is the same as the population mean. In equation
form, that’s:
𝑠 𝜎
𝑠𝑡𝑎𝑛𝑑𝑎𝑟𝑑 𝑒𝑟𝑟𝑜𝑟 = 𝑆𝐸 = or 𝜎𝑥ҧ =
𝑛 𝑛

15
Applied Statistic For Machine Learning - Ehsan Maminejad
Example 1/ Bootstrapping

16
Applied Statistic For Machine Learning - Ehsan Maminejad
More on Normal Dist. And QQ-Plot

▪ Error:
▪ The difference between a data point and a predicted or average value.
▪ Standardize:
▪ Subtract the mean and divide by the standard deviation.
▪ z-score:
▪ The result of standardizing an individual data point.
▪ Standard normal:
▪ A normal distribution with mean = 0 and standard deviation = 1.
▪ QQ-Plot:
▪ A plot to visualize how close a sample distribution is to a specified distribution, e.g.,
the normal distribution.

17
Applied Statistic For Machine Learning - Ehsan Maminejad
More on Normal Dist. And QQ-Plot

18
Applied Statistic For Machine Learning - Ehsan Maminejad
More on Normal Dist. And QQ-Plot

19
Applied Statistic For Machine Learning - Ehsan Maminejad
Student’s t-Distribution:
The t-distribution is actually a family of distributions
resembling the normal distribution but with thicker tails.

20
Applied Statistic For Machine Learning - Ehsan Maminejad
‫‪Example 2/ Confidence Interval‬‬

‫یک شرکت سیستم‌های ناوبری برای بازاریابی محصوالت قابل حمل خود میخواهد بداند هر یک از باتر‌ی‌های‬
‫محصوالت خود‪ ،‬به طور متوسط‪ ،‬قبل از سوختن چقدر دوام می‌آورد؟ کارمندان شرکت عالقه‌مند هستند با‬
‫اطمینان ‪ 95‬درصد این مقدار متوسط را تخمین بزنند‪ .‬آنها ‪ 100‬عدد باتری را به عنوان نمونه انتخاب می‌کنند و‬
‫متوجه می‌شوند که میانگین نمونه ‪ 60‬ساعت است و انحراف معیار استاندارد آن ‪ 20‬ساعت است‪.‬‬

‫‪21‬‬
‫‪Applied Statistic For Machine Learning - Ehsan Maminejad‬‬
‫‪Example 2/ Confidence Interval‬‬
‫یک شرکت سیستم‌های ناوبری برای بازاریابی محصوالت قابل حمل خود میخواهد بداند هر یک از باتر‌ی‌های‬
‫محصوالت خود‪ ،‬به طور متوسط‪ ،‬قبل از سوختن چقدر دوام می‌آورد؟ کارمندان شرکت عالقه‌مند هستند با‬
‫اطمینان ‪ 95‬درصد این مقدار متوسط را تخمین بزنند‪ .‬آنها ‪ 100‬عدد باتری را به عنوان نمونه انتخاب می‌کنند و‬
‫متوجه می‌شوند که میانگین نمونه ‪ 60‬ساعت است و انحراف معیار استاندارد آن ‪ 20‬ساعت است‪.‬‬

‫𝜎‬ ‫𝑠‬ ‫‪20‬‬


‫= ‪𝜎𝑥ҧ‬‬ ‫???‬ ‫= ‪𝑠𝑥ҧ‬‬ ‫=‬ ‫‪=2‬‬
‫𝑛‬ ‫𝑛‬ ‫‪100‬‬

‫‪22‬‬
‫‪Applied Statistic For Machine Learning - Ehsan Maminejad‬‬
‫‪Example 2/ Confidence Interval‬‬

‫اگر بارها و بارها نمونه تصادفی با اندازه یکسان از جامعه آماری بگیرید‪ ،‬در‬
‫‪95‬درصد مواقع میانگین این نمونه‌ها در فاصله ‪ 56‬تا ‪ 64‬قرار می گیرد‪.‬‬

‫‪23‬‬
‫‪Applied Statistic For Machine Learning - Ehsan Maminejad‬‬
Thank you!

Applied Statistic For Machine Learning - Ehsan Maminejad 24

You might also like