V1

2023/05/16阅读：14主题：姹紫

# 统计学01: 中心极限定律、正态分布、z-score

<~生~信~交~流~与~合~作~请~关~注~公~众~号@生信探索>

## 中心极限定律

For samples of size 30 or more, the sample mean is approximately normally distributed

## 正态分布

Z分布，即标准正态分布，z=(x−μ)/σ，Z值可以查表。

Standardizing with Z scores

Since we cannot just compare these two raw scores, we instead compare how many standard deviations beyond the mean each observation is.

• Pam's score is (1800 - 1500) / 300 = 1 standard deviation above the mean.
• Jim's score is (24 - 21) / 5 = 0.6 standard deviations above the mean.

So Pam is better.

## z-score

z-scores are the signed number of standard deviations above the mean that an observation lies, z=(x−μ)/σ

• python

axis=0时对列z-score处理

ddof=1的意思是（自由度）计算标准差中分母上是n-1，默认是n-0，n就是样本数；当axis=0时，n=5

import numpy as npfrom scipy.stats import zscorem = np.array([[ 0.3148,  0.0478,  0.6243,  0.4608],              [ 0.7149,  0.0775,  0.6072,  0.9656],              [ 0.6341,  0.1403,  0.9759,  0.4064],              [ 0.5918,  0.6948,  0.904 ,  0.3721],              [ 0.0921,  0.2481,  0.1188,  0.1366]])zscore(m, axis=1, ddof=0)
• julia

using StatsBasem = [0.3148  0.0478 0.6243 0.4608  0.7149 0.0775 0.6072 0.9656  0.6341 0.1403 0.9759 0.4064  0.5918 0.6948 0.904 0.3721  0.0921 0.2481 0.1188 0.1366]μ = mean.(eachrow(m'))σ = std.(eachrow(m'))z=zscore(m', μ, σ)z'
• R

m = matrix(c(0.3148,  0.0478,  0.6243,  0.4608,  0.7149,  0.0775,  0.6072,  0.9656,  0.6341,  0.1403,  0.9759,  0.4064,  0.5918,  0.6948,  0.904 ,  0.3721,  0.0921,  0.2481,  0.1188,  0.1366)  ,ncol=4,byrow=T)scale(m)

## Reference

https://spot.pcc.edu/math/ahss/ed2/distributionofxbar.html
https://www.bilibili.com/video/BV1CA411P7bL
https://stats.libretexts.org/Bookshelves/Introductory_Statistics/Introductory_Statistics_(Shafer_and_Zhang)/06%3A_Sampling_Distributions/6.02%3A_The_Sampling_Distribution_of_the_Sample_Mean
https://zhuanlan.zhihu.com/p/141732064
https://baike.baidu.com/item/Z%E5%88%86%E6%95%B0/8268473
https://people.umass.edu/biep540w/pdf/Open%20Intro%20Slides%20-%20Normal%20Distribution.pdf#:~:text=SAT%20scores%20are%20distributed%20nearly%20normally%20with%20mean,Jim%2C%20who%20scored%20a%2024%20on%20his%20ACT%3F


V1