  We present a new method for the numerical treatment of second order phase
transitions using the level spacing distribution function $P(s)$. We show that
the quantities introduced originally for the shape analysis of eigenvectors can
be properly applied for the description of the eigenvalues as well. The
position of the metal--insulator transition (MIT) of the three dimensional
Anderson model and the critical exponent are evaluated. The shape analysis of
$P(s)$ obtained numerically shows that near the MIT $P(s)$ is clearly different
from both the Brody distribution and from Izrailev's formula, and the best
description is of the form $P(s)=c_1\,s\exp(-c_2\,s^{1+\beta})$, with
$\beta\approx 0.2$. This is in good agreement with recent analytical results.
