Prev: 64-bit mex problems
Next: Symbolic toolbox in r2007b
From: Peter Perkins on 31 Jul 2008 14:50 Gael Abgrall wrote: >> Can you post (as a mat file) the exact data that led >> to the results in your original post? > > Here is a mat file with the data (it is not exactly the same > but it produces the same result) : I hadn't even noticed this in your original post, but you've only gotten back the first output from normfit, with the result that you're testing against a normal distribution with unit variance. You've started by specifying 30 bins, which are chosen based on the data, but a N(mu,1) distribution is so far from the data that of the 30 bins you started with, all but the two near the mean have essentially zero expected count, and so the pooling leaves onl,y two bins. Thus the 0 d.f., and the NaN p-value. What you want is either: >> [mu,sigma] = normfit(lat); >> [h,p, stats] = chi2gof(lat,'cdf',@(x) normcdf(x,mu,sigma),'nbins', 30, 'nparams',2) h = 1 p = 0 stats = chi2stat: 2089.1 df: 5 edges: [192.59 203.18 213.77 224.36 234.95 245.54 256.13 266.72 510.29] O: [50 958 2345 1242 271 49 24 59] E: [581.59 890.18 1251.3 1165.6 719.44 294.16 79.628 16.088] or to specify the bins for the test explicitly. By the way, if you use DFITTOOL to fit a normal distribution to these data, and plot either the PDF or the CDF, you find that you don't need a chi-squared test to reject the normal hypothesis. Hope this helps. - Peter Perkins The MathWorks, Inc.
From: Gael Abgrall on 1 Aug 2008 03:20
> By the way, if you use DFITTOOL to fit a normal distribution to these data, and plot either the PDF or the CDF, you find that you don't need a chi-squared test to reject the normal hypothesis. I've just test DFITTOOL (I didn't know this tool) and it will help me a lot ! Thanks ! Gael. |