binoci.m 385 B

1234567891011121314151617181920212223242526
  1. function ci = binoci(x,lowhigh, cirange)
  2. % ci = binoci(x)
  3. % x is a boolean vector
  4. % lowhigh is 'low','high' or 'both' ['both']
  5. % ci is the binomial confidence
  6. %
  7. if nargin<2
  8. lowhigh = 'both';
  9. end
  10. if nargin<3
  11. cirange = 0.05;
  12. end
  13. [~,ci] = binofit(sum(x),numel(x),cirange);
  14. switch lowhigh
  15. case 'low'
  16. ci = ci(1);
  17. case 'high'
  18. ci = ci(2);
  19. end