資源簡介
計(jì)算AUC,畫出ROC曲線,給出各種統(tǒng)計(jì)參數(shù)
matlab 程序
代碼片段和文件信息
function?[ROCoutHR1]=nonestoproc(varargin)
%?ROC?-?Receiver?Operating?Characteristics.
%?The?ROC?graphs?are?a?useful?tecnique?for?organizing?classifiers?and
%?visualizing?their?performance.?ROC?graphs?are?commonly?used?in?medical
%?decision?making.
%?If?you?have?downloaded?partest
%?http://www.mathworks.com/matlabcentral/fileexchange/12705
%?the?routine?will?compute?several?data?on?test?performance.
%
%?Syntax:?ROCout=roc(xthresholdsalphaverbose)
%
%?Input:?x?-?This?is?a?Nx2?data?matrix.?The?first?column?is?the?column?of?the?data?value;
%????????????The?second?column?is?the?column?of?the?tag:?unhealthy?(1)?and
%????????????healthy?(0).
%????????Thresholds?-?If?you?want?to?use?all?unique?values?in?x(:1)?
%????????????then?set?this?variable?to?0?or?leave?it?empty;?
%????????????else?set?how?many?unique?values?you?want?to?use?(min=3);
%????????alpha?-?significance?level?(default?0.05)
%????????verbose?-?if?you?want?to?see?all?reports?and?plots?(0-no;?1-yes?by
%????????default);
%
%?Output:?if?verbose?=?1
%?????????the?ROCplots?the?sensitivity?and?specificity?at?thresholds;?the?Area
%?????????under?the?curve?with?Standard?error?and?Confidence?interval?and
%?????????comment?Cut-off?point?for?best?sensitivity?and?specificity.?
%?????????(Optional)?the?test?performances?at?cut-off?point.
%?????????if?ROCout?is?declared?you?will?have?a?struct:
%?????????ROCout.AUC=Area?under?the?curve?(AUC);
%?????????ROCout.SE=Standard?error?of?the?area;
%?????????ROCout.ci=Confidence?interval?of?the?AUC
%?????????ROCout.co=Cut?off?point?for?best?sensitivity?and?sensibility
%?????????ROCdata.xr?and?ROCdata.yr?points?for?ROC?plot
%
%?USING?roc?WITHOUT?ANY?DATA?IT?WILL?RUN?A?DEMO
%
%???????????Created?by?Giuseppe?Cardillo
%???????????giuseppe.cardillo-edta@poste.it
%
%?To?cite?this?file?this?would?be?an?appropriate?format:
%?Cardillo?G.?(2008)?ROC?curve:?compute?a?Receiver?Operating?Characteristics?curve.
%?http://www.mathworks.com/matlabcentral/fileexchange/19950
%Input?Error?handling
args=cell(varargin);
nu=numel(args);
if?isempty(nu)
????error(‘Warning:?almost?the?data?matrix?is?required‘)
elseif?nu>5
????error(‘Warning:?Max?four?input?data?are?required‘)
end
default.values(1:nu)?=?args;
[x?threshold?alpha?verbose?tapy]?=?deal(default.values{:});
if?isvector(x)
????error(‘Warning:?X?must?be?a?matrix‘)
end
if?~all(isfinite(x(:)))?||?~all(isnumeric(x(:)))
????error(‘Warning:?all?X?values?must?be?numeric?and?finite‘)
end
x(:2)=logical(x(:2));
if?all(x(:2)==0)
????error(‘Warning:?there?are?only?healthy?subjects!‘)
end
if?all(x(:2)==1)
????error(‘Warning:?there?are?only?unhealthy?subjects!‘)
end
if?nu>=2
????if?isempty(threshold)
????????threshold=0;
????else
????????if?~isscalar(threshold)?||?~isnumeric(threshold)?||?~isfinite(threshold)
????????????error(‘Warning:?it?is?required?a?numeric?finite?and?scalar?THRESHOLD?value.‘);
????????end
????????if?threshold?~=?0?&&?threshold?<3
???
評(píng)論
共有 條評(píng)論