Hughes and Hase Problem 8.2

In [1]:
import numpy as np
from scipy import stats

(a)

The reduced chi-squared statistic is defined as

$$ \chi^2_\nu \equiv \frac{\chi^2_{\rm min}}{\nu}, $$

where $\nu$ is the number of degrees of freedom. So in this part we have

$$ \chi^2_\nu = \frac{15.9}{10} = 1.59 $$

(b)

We can use the CDF of the chi-squared distribution to calculate the probability of getting a value of the reduced chi-squared statistic greater than of equal to 1.59:

$$ P(\chi^2_{\rm min},\nu) = 1 - C_{DF} $$

In [2]:
1 - stats.chi2.cdf(15.9, 10)
Out[2]:
0.10253102145831061

We find about a 10% chance of getting a value of $\chi^2_\nu$ this large.

(c)

In this part we have a a larger value of $\chi^2{\rm min}$, and more degrees of freedom, giving

$$ \chi^2_\nu = \frac{15.9}{100} = 1.59, $$

which the same value found in part (a).

(d)

Using the CDF again, we the probability of getting this same value of $\chi^2_\nu$ now:

In [3]:
1 - stats.chi2.cdf(159, 100)
Out[3]:
0.0001599798564519972

The probability is 0.016%. These is a very different probability than than that found in part (b), even though the fits have the same value of $\chi^2_\nu$, which illustrates the hazards of relying on that one simple diagnostic to make judgments. With the larger number of degrees of freedom, a value as large as $\chi^2_\nu = 1.59$ becomes much more improbable.

Version information

version_information is from J.R. Johansson (jrjohansson at gmail.com); see Introduction to scientific computing with Python for more information and instructions for package installation.

version_information is installed on the linux network at Bucknell

In [4]:
%load_ext version_information
In [6]:
version_information numpy, scipy
Out[6]:
SoftwareVersion
Python3.7.7 64bit [GCC 7.3.0]
IPython7.16.1
OSLinux 3.10.0 1062.9.1.el7.x86_64 x86_64 with centos 7.7.1908 Core
numpy1.18.5
scipy1.5.2
Thu Aug 06 14:39:15 2020 EDT
In [ ]: