score_KS

PURPOSE ^

input: mdv structure as usual

SYNOPSIS ^

function [out] = score_KS(mdv, hilo, lambda)

DESCRIPTION ^

input:  mdv  structure as usual
        hilo  (0's and 1's)  Ideally there will be a similar # of each.
        lambda = weighting.  If the mean is less than lambda, the scores get weighted less.  (default = .02)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [out] = score_KS(mdv, hilo, lambda)
0002 %input:  mdv  structure as usual
0003 %        hilo  (0's and 1's)  Ideally there will be a similar # of each.
0004 %        lambda = weighting.  If the mean is less than lambda, the scores get weighted less.  (default = .02)
0005 
0006 if nargin < 3
0007     lambda = .02;
0008 end
0009 
0010 [nvars, npoints] = size(mdv);
0011 loset = mdv(:,hilo==0);
0012 hiset = mdv(:,hilo==1);
0013 
0014 weights = std(mdv,0,2);
0015 
0016 scores = zeros(nvars, 1);
0017 parfor i = 1:nvars
0018     
0019     [h, p] = kstest2(loset(i,:), hiset(i,:));
0020     scores(i) = max(log(p), -708); % log(realmin) to avoid scores of inf.
0021     
0022 end
0023 
0024 scores2 = scores .*(1-exp(-weights/lambda));
0025 out = -sum(scores2);

Generated on Thu 21-Jun-2012 15:39:23 by m2html © 2003