view m-toolbox/test/test_ao_qqplot.m @ 25:79dc7091dbbc database-connection-manager

Update tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% 
% 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)