bootlda.m 931 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. function [p,D]=bootlda(A,B,varargin)
  2. % [p,D]=bootsigmoid(A,B,varargin)
  3. % Takes two sets of data A and B with D columms and calculated fisher's linear
  4. % discriminant and measures the roc between the data points in group A and B projected onto the LDA.
  5. % Then we permute the rows of A and B to generate permuted data sets and
  6. % perform roc on the permuated. Finally, the distance
  7. % between A and B fits are compared to the distribution of distances
  8. % generated by permuting A and B.
  9. BOOTS=10000;
  10. utils.overridedefaults(who,varargin);
  11. n_A=size(A,1);
  12. n_B=size(B,1);
  13. vAB=flda(A,B);
  14. [aucv,aucp]=bootroc(A*vAB, B*vAB);
  15. permAB=nan(BOOTS,1);
  16. M=[A;B];
  17. for bx=1:BOOTS
  18. rperm=randperm(n_A+n_B);
  19. rA=M(rperm(1:n_A),:);
  20. rB=M(rperm((n_A+1):end),:);
  21. rvAB=flda(rA,rB);
  22. permAB(bx)=auc(rA*rvAB,rB*rvAB);
  23. end
  24. p= stats.get_p(aucv,permAB);
  25. D.ld=vAB;
  26. D.bootp=p;
  27. D.aucv=aucv;
  28. D.aucp=aucp;
  29. D.permAB=permAB;