\[ \chi_r^2=\frac{1}{N-f}\sum_{i}\frac{\left| y(x_i) - y_i \right|^2}{\sigma^2_i} \]

$N$ = number of data points
$f$ = number of parameters in fit (e.g. $f=4$ for a cubic fit)