QQ图几年前就听过,但不知道代表什么,也没有动力去弄明白,现在明白了;Q代表quantile,图上的每一个点有个内在属性,就是两组数据的分位点是相同的;比如说某个点是数据集1的上四分位点,那么也一定是数据集2的上四分位点;
The quantile-quantile (q-q) plot is a graphical technique for determining if two data sets come from populations with a common distribution;
由此可以推断:两个数据集的数据一定是排好序的;
QQ图还会有一个直线进行对比;
A 45-degree reference line is also plotted. If the two sets come from a population with the same distribution, the points should fall approximately along this reference line. The greater the departure from this reference line, the greater the evidence for the conclusion that the two data sets have come from populations with different distributions.
使用案例:
import tushare as ts
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
data=ts.get_k_data('002230')
#data[['close','open']].hist(bins=30,figsize=(15,8))
import scipy.stats as stats
N = 1200
p = 0.53
q = 1000
obs = np.random.binomial(N, p, size = q)/N
z = (obs-np.mean(obs))/np.std(obs)
stats.probplot(data['open'], dist="norm", plot=plt)
plt.title("Normal Q-Q plot")
plt.show()