A brief review of probability theory
Fundamental rules
- product rule:
yield chain rule:
- sum rule:
- Bayes rule:
Quantiles(分位数)
cdf是,逆函数是
,
分位数的作用是,有
, 表示的意思是
。
也就是说, 是一个概率值,代入累积分布的逆函数中,返回的是对应概率面积的截断点:
根据公式
测试:
import numpy as np
import scipy.stats as st
st.norm.ppf(0.975) # 1.959963984540054
st.norm.ppf(0.025) # -1.9599639845400545
st.norm.cdf(1.959963984540054) - st.norm.cdf(-1.9599639845400545) # 0.95
The empirical distribution

Degenerate pdf
-
Covariance matrix:
image.png
-
Pearson correlation coefcient :
,则
与
线性相关,不一定相互独立;但是相互独立则不线性相关,
。
Transformations of random variables
- 多元分布的变量转换公式:
- Jacobian matrix
:
image.png
例子:
image.png
Central limit theorem
Monte Carlo approximation
作用:Approximate the distribution of by using the empirical distribution of
.
例子:

- 求
值的例子:
def generation_point(nums,r):
x = np.random.uniform(-r, r,nums)
y = np.random.uniform(-r, r, nums)
r_square = np.sqrt(np.square(x) + np.square(y))
count = r_square<r
pi = sum(count) / nums * 4
return x, y,count, pi
x, y, count, pi = generation_point(10000,4)
print(pi) # 3.138
# plot
data = ps.DataFrame({'x':x,'y':y,"color":count})
sns.set(style='darkgrid')
plt.figure(dpi=300)
sns.scatterplot(x="x",y="y",data=data,hue='color')

网友评论