Mercurial > hg > ltpda
comparison m-toolbox/test/test_ao_qqplot.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % | |
2 % A test script for qqplot | |
3 % | |
4 % L Ferraioli 30-06-2011 | |
5 % | |
6 % $Id: test_ao_qqplot.m,v 1.1 2011/07/08 10:36:51 luigi Exp $ | |
7 % | |
8 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
9 %% useful vars | |
10 nsecs = 1000; | |
11 fs = 1; | |
12 | |
13 %% build test objects | |
14 | |
15 a1 = ao.randn(nsecs,fs); | |
16 a2 = ao.randn(nsecs,fs); | |
17 a3 = ao.randn(nsecs,fs); | |
18 a4 = ao.randn(nsecs,fs); | |
19 | |
20 | |
21 %% test empirical | |
22 | |
23 qqplot(a1,a2,a3) | |
24 | |
25 %% test Gaussian | |
26 | |
27 plcdf = plist('TESTDISTRIBUTION','NORMAL'); | |
28 qqplot(a1,a2,a3,plcdf) | |
29 | |
30 %% test Chi2 | |
31 | |
32 % chi2 with 2 degrees of freedom | |
33 y1 = a1.^2 + a2.^2; | |
34 y2 = a3.^2 + a4.^2; | |
35 | |
36 plcdf = plist('TESTDISTRIBUTION','CHI2','DOF',2); | |
37 qqplot(y1,y2,plcdf) | |
38 | |
39 %% test F | |
40 | |
41 % chi2 with 2 degrees of freedom | |
42 y1 = a1.^2 + a2.^2; | |
43 y2 = a3.^2 + a4.^2; | |
44 % f distribution with 2 and 2 degrees of freedom | |
45 y3 = y1./y2; | |
46 | |
47 plcdf = plist('TESTDISTRIBUTION','F','DOF1',2,'DOF2',2); | |
48 qqplot(y3,plcdf) | |
49 | |
50 %% test Gamma | |
51 | |
52 % this requires statistics toolbox | |
53 k = 10; % shape parameter | |
54 theta = 2; % scale parameter | |
55 Y1 = random('Gamma',k,theta,1000,1); | |
56 b1 = ao(plist('fs', 1, 'yvals', Y1, 'type', 'tsdata')); | |
57 Y2 = random('Gamma',k,theta,1000,1); | |
58 b2 = ao(plist('fs', 1, 'yvals', Y2, 'type', 'tsdata')); | |
59 | |
60 plcdf = plist('TESTDISTRIBUTION','GAMMA','SHAPE',k,'SCALE',theta); | |
61 qqplot(b1,b2,plcdf) |