# At chi squared qq plot, shouldn't normal samples be placed diagonally with chi-square?

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")
plt.show()
return

chi2plot(x)


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?

• Always a good idea to state what software you're using. Mar 28, 2021 at 9:39

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.