title: Chi squared test
body: <p>I have written code in MATLAB for a <a href="https://en.wikipedia.org/wiki/Chi-squared_test" rel="nofollow noreferrer">Chi-Square test</a>. I wish to obtain P-values as 0.897 or 0.287 and so on, but my results are too small.  Below is my code:</p>
  
  <pre><code>pd = fitdist(sample, 'weibull');
  [h,p,st] = chi2gof(sample,'CDF',pd)
  </code></pre>
  
  <p>I've also tried using the <a href="https://en.wikipedia.org/wiki/Anderson%E2%80%93Darling_test" rel="nofollow noreferrer">AD test</a> with similar result:</p>
  
  <pre><code>dist = makedist('Weibull', 'a',A, 'b',B);
  [h,p,ad,cv] = adtest(sample, 'Distribution',dist)
  </code></pre>
  
  <p>Below is a histogram of the data with a fitted Weibull density function (Weibull parameters are <code>A=4.0420</code> and <code>B=2.0853</code>)</p>
  
  <p><img src="https://i.stack.imgur.com/m1bPZ.jpg" alt="histfit"></p>