I tried to draw a chi-square qq plot from sample following a bivariate normal distribution. This is my code:

x = pd.DataFrame(np.random.multivariate_normal([0, 0], [[1, 0], [0, 1]], 100000))

def chi2plot(x):
    m = x.mean()
    s = x.cov()
    s_inv = np.linalg.inv(s)
    d = np.zeros(len(x))
    for i in range(len(x)):
        d[i] = (x.iloc[i,]-m).dot(s_inv).dot(x.iloc[i,]-m)
    sm.qqplot(d, stats.chi, distargs=(2,), fit=True, line="45")
    plt.title("chi-square for price and weight")


enter image description here

And when I run the code, it returns the qq plot above. I thought dots should be on the diagonal, but for me, the placement of the dots seems to fall significantly from the diagonal. Is this the right result for a sample following bivariate normal distribution with qq plot?

  • $\begingroup$ Always a good idea to state what software you're using. $\endgroup$
    – Nick Cox
    Mar 28, 2021 at 9:39

1 Answer 1


Your graph checks if your variable follows a chi squared distribution while you know it follows a standard normal distribution. It is no surprise that that fails. However if you squared $x$ first you should get a chi squared distribution with 1 degree of freedom.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.