bootroc.m 732 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. function varargout=bootroc(A,B,BOOTS, CI)
  2. % [auc, auc_p, auc_ci]=bootroc(A,B,BOOTS, CI);
  3. %
  4. % A is a vector of the value of elements from condition A
  5. % B is a vector of the value of elements from condition B
  6. %
  7. if nargin<3
  8. BOOTS=1000;
  9. end
  10. if nargin<4
  11. CI=99.5;
  12. end
  13. A=A(~isnan(A));
  14. B=B(~isnan(B));
  15. if isempty(A) || isempty(B)
  16. sd=nan;
  17. sd_p=nan;
  18. boot_score=nan;
  19. else
  20. sd=stats.auc(A,B);
  21. sA=numel(A);
  22. ALL_DATA=[A(:);B(:)];
  23. boot_score=0.5+zeros(BOOTS,1);
  24. for bx=1:BOOTS
  25. shuff_d=ALL_DATA(randperm(numel(ALL_DATA)));
  26. A=shuff_d(1:sA);
  27. B=shuff_d(sA+1:end);
  28. boot_score(bx)=stats.auc(A,B);
  29. end
  30. sd_p= stats.get_p(sd, boot_score);
  31. end
  32. varargout{1}=sd;
  33. varargout{2}=sd_p;
  34. varargout{3}=prctile(boot_score, [(100-CI) CI]);