I am currently fitting a model to a dataset. To measure the goodness-of-fit I am using the chi-square test with
$H_0$: The model fits the data ($\chi^2 \lt \chi^2_{critical}$)
$H_1$: The model does not fit the data ($\chi^2 \gt \chi^2_{critical}$)
The figure below shows the datapoints in black as well as the fitted model in orange.
The datapoints in black are occurences of an event (disclosure of a security vulnerability) along the time axis. At time 1 there have been 2 events in total. At time 101 there have been 160 events in total.
Thus, $\text{df} = 101-1 = 100$
The orange curve is obtained by fitting the alhazmi malaiya logistics model (a known model for modelling the vulnerability discovery process) given by the equation
$\Omega(t) = \frac{B}{B\times C\times e^{-A\times B\times t} + 1}$
Parameters A, B and C are selected during the fitting process such that the model describes the datapoints as good as possible. Therefore the parameter combination that results in the lowest $\chi^2$ has been selected.
$\chi^2$ is calculated by using the datapoints (black) as $o_i$ and the values obtained by solving the equation at time t as $e_i$ in the formula
$\chi^2 = \sum\frac{(o_i - e_i)^2}{e_i}$
This gives me in my case $\chi^2 = 111.8410$ and by selecting $\alpha = 5\%$ I get a critical value of $124.3421$. As $111.8410 \lt 124.3421$ I accept my $H_0$ which states that the datapoints are distributed according to the model or, in other words, the model describes the data reasonably well.
In the above case, what exactly is the P-Value of this $\chi^2$-Test?
According to Pearson's chi-square test, the P-Value is calculated by
$ \text{P-Value} = 1 - \text{chi2cdf}(\chi^2, \text{df})$
This would in this case result in a P-Value of $0.0967$ which would suggest a significant fit of the model. But shouldn't the P-Value for a good fit (a fit that has been especialy made for the data) be close to 1?
Is this calculation correct?
Unfortunately, the literature I am working with does not properly explain the used methodology and I can't seem to reproduce the results. One of the papers using the approach above is http://www.cs.colostate.edu/~malaiya/pub/issre05.pdf. Their goodness-of-fit test is described on page 5, last section.
chi2cdf(118.8032, 159)
. The result is 0.0073. $\endgroup$