Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/test/test_ao_qqplot.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,61 @@ +% +% A test script for qqplot +% +% L Ferraioli 30-06-2011 +% +% $Id: test_ao_qqplot.m,v 1.1 2011/07/08 10:36:51 luigi Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% useful vars +nsecs = 1000; +fs = 1; + +%% build test objects + +a1 = ao.randn(nsecs,fs); +a2 = ao.randn(nsecs,fs); +a3 = ao.randn(nsecs,fs); +a4 = ao.randn(nsecs,fs); + + +%% test empirical + +qqplot(a1,a2,a3) + +%% test Gaussian + +plcdf = plist('TESTDISTRIBUTION','NORMAL'); +qqplot(a1,a2,a3,plcdf) + +%% test Chi2 + +% chi2 with 2 degrees of freedom +y1 = a1.^2 + a2.^2; +y2 = a3.^2 + a4.^2; + +plcdf = plist('TESTDISTRIBUTION','CHI2','DOF',2); +qqplot(y1,y2,plcdf) + +%% test F + +% chi2 with 2 degrees of freedom +y1 = a1.^2 + a2.^2; +y2 = a3.^2 + a4.^2; +% f distribution with 2 and 2 degrees of freedom +y3 = y1./y2; + +plcdf = plist('TESTDISTRIBUTION','F','DOF1',2,'DOF2',2); +qqplot(y3,plcdf) + +%% test Gamma + +% this requires statistics toolbox +k = 10; % shape parameter +theta = 2; % scale parameter +Y1 = random('Gamma',k,theta,1000,1); +b1 = ao(plist('fs', 1, 'yvals', Y1, 'type', 'tsdata')); +Y2 = random('Gamma',k,theta,1000,1); +b2 = ao(plist('fs', 1, 'yvals', Y2, 'type', 'tsdata')); + +plcdf = plist('TESTDISTRIBUTION','GAMMA','SHAPE',k,'SCALE',theta); +qqplot(b1,b2,plcdf)