Home > data-utility > granger_causality > gcause_libs > ksplot_trial.m

ksplot_trial

PURPOSE ^

KS plot using estimated model parameters

SYNOPSIS ^

function [z_sorted,b,bp,bn] = ksplot_trial(X,bhat,ht,neuron)

DESCRIPTION ^

 KS plot using estimated model parameters

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % KS plot using estimated model parameters
0002 
0003 function [z_sorted,b,bp,bn] = ksplot_trial(X,bhat,ht,neuron)
0004 
0005 % Size of input data
0006 [CHN SMP TRL] = size(X);
0007 
0008 Z = [];
0009 for itrial = 1:TRL
0010 
0011     temp = ones(SMP-ht,1);
0012     for ichannel = 1:CHN
0013         for hh = 0:3:ht-3
0014             temp0 = X(ichannel,ht-hh:SMP-1-hh,itrial)' + X(ichannel,ht-1-hh:SMP-2-hh,itrial)' + X(ichannel,ht-2-hh:SMP-3-hh,itrial)';
0015             temp = [temp temp0];
0016         end
0017     end
0018     LAMBDA = exp(temp*bhat);
0019 
0020     eventloc{itrial} = find(X(neuron,ht+1:end,itrial));
0021     
0022     if length(eventloc{itrial})-1 == 0
0023         Z = [Z];
0024     else    
0025         for ievent = 1:length(eventloc{itrial})-1
0026             tau(ievent) = sum(LAMBDA(eventloc{itrial}(ievent):eventloc{itrial}(ievent+1)));
0027             temp = 1 - exp(-tau(ievent));
0028             Z = [Z temp];
0029         end        
0030     end
0031         
0032 end
0033 
0034 z_sorted = sort(Z);
0035 lengz = length(z_sorted);
0036 for iepoch = 1:lengz
0037     b(iepoch) = (iepoch-.5)/lengz;
0038     bp(iepoch) = b(iepoch) + 1.36/sqrt(lengz);
0039     bn(iepoch) = b(iepoch) - 1.36/sqrt(lengz);
0040 end
0041 
0042 % figure;plot(b,z_sorted);ylim([0 1]);
0043 % hold on
0044 % plot(b,b);
0045 % plot(b,bp,':');
0046 % plot(b,bn,':');
0047 % xlabel('Qunatiles');
0048 % ylabel('Cumulative Distribution Function');
0049 
0050 
0051

Generated on Wed 24-May-2017 00:00:56 by m2html © 2005