Changeset 14182


Ignore:
Timestamp:
12/17/12 21:56:54 (12 years ago)
Author:
jschierm
Message:

CHG: Replaced calls to normfit/normcdf/norminv and applied error handling to tinv/chi2inv.

Location:
issm/trunk-jpl/src/m
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/qmu/dakota_cdfs.m

    r13646 r14182  
    247247        irow=irow+1;
    248248        cdf(irow,1)=resp(i);
    249         cdf(irow,2)=normcdf(resp(i),mu,sigma);
     249        cdf(irow,2)=normcdf_issm(resp(i),mu,sigma);
    250250        cdf(irow,3)=(mu-resp(i))/sigma;
    251251        cdf(irow,4)=(mu-resp(i))/sigma;
     
    256256    for i=1:length(prob)
    257257        irow=irow+1;
    258         cdf(irow,1)=norminv(prob(i),mu,sigma);
     258        cdf(irow,1)=norminv_issm(prob(i),mu,sigma);
    259259        cdf(irow,2)=prob(i);
    260         cdf(irow,3)=-norminv(prob(i),0,1);
    261         cdf(irow,4)=-norminv(prob(i),0,1);
     260        cdf(irow,3)=-norminv_issm(prob(i),0,1);
     261        cdf(irow,4)=-norminv_issm(prob(i),0,1);
    262262    end
    263263
     
    267267        irow=irow+1;
    268268        cdf(irow,1)=mu-sigma*rel(i);
    269         cdf(irow,2)=normcdf(-rel(i),0,1);
     269        cdf(irow,2)=normcdf_issm(-rel(i),0,1);
    270270        cdf(irow,3)=rel(i);
    271271        cdf(irow,4)=rel(i);
     
    277277        irow=irow+1;
    278278        cdf(irow,1)=mu-sigma*grel(i);
    279         cdf(irow,2)=normcdf(-grel(i),0,1);
     279        cdf(irow,2)=normcdf_issm(-grel(i),0,1);
    280280        cdf(irow,3)=grel(i);
    281281        cdf(irow,4)=grel(i);
  • issm/trunk-jpl/src/m/qmu/dakota_moments.m

    r13646 r14182  
    133133    sigma=std(samp);
    134134
    135     muci(1)   =mu-tinv(prob,nsamp-1)*sigma/sqrt(nsamp);
    136     muci(2)   =mu+tinv(prob,nsamp-1)*sigma/sqrt(nsamp);
    137     sigmaci(1)=sigma*sqrt((nsamp-1)/chi2inv(prob  ,nsamp-1));
    138     sigmaci(2)=sigma*sqrt((nsamp-1)/chi2inv(1-prob,nsamp-1));
     135        try
     136        muci(1,1)   =mu-tinv(prob,nsamp-1)*sigma/sqrt(nsamp);
     137        muci(2,1)   =mu+tinv(prob,nsamp-1)*sigma/sqrt(nsamp);
     138        sigmaci(1,1)=sigma*sqrt((nsamp-1)/chi2inv(prob  ,nsamp-1));
     139        sigmaci(2,1)=sigma*sqrt((nsamp-1)/chi2inv(1-prob,nsamp-1));
     140        catch me
     141        muci(1,1)   =mu;
     142        muci(2,1)   =mu;
     143        sigmaci(1,1)=sigma;
     144        sigmaci(2,1)=sigma;
     145        end
    139146
    140147end
  • issm/trunk-jpl/src/m/qmu/dakota_out_parse.m

    r13646 r14182  
    198198    %dstddev=std    (data,0);
    199199    [dmean,dstddev,dmeanci,dstddevci]=...
    200         normfit(data,0.05);
     200        normfit_issm(data,0.05);
    201201else
    202202    dmean    =zeros(1,size(data,2));
     
    206206    for i=1:size(data,2)
    207207        [dmean(1,i),dstddev(1,i),dmeanci(:,i),dstddevci(:,i)]=...
    208             normfit(data(:,i),0.05);
     208            normfit_issm(data(:,i),0.05);
    209209    end
    210210end
  • issm/trunk-jpl/src/m/qmu/plot/plot_cdf.m

    r13646 r14182  
    139139        if strncmpi(cplot,'p',1) && ...
    140140           exist('ynorm','var') && strncmpi(ynorm,'y',1)
    141              ydata(1:lcdfr(i),i)=norminv(dresp(i).cdf(:,iplot),0,1);
     141             ydata(1:lcdfr(i),i)=norminv_issm(dresp(i).cdf(:,iplot),0,1);
    142142        else
    143              ydata(1:lcdfr(i),i)=        dresp(i).cdf(:,iplot);
     143             ydata(1:lcdfr(i),i)=             dresp(i).cdf(:,iplot);
    144144        end
    145145    end
     
    237237    end
    238238
    239     tick  = norminv(yprob,0,1);
     239    tick  = norminv_issm(yprob,0,1);
    240240    set(ax1,'YTick',tick,'YTickLabel',label);
    241241    ylim([tick(1) tick(end)])
  • issm/trunk-jpl/src/m/qmu/plot/plot_hist_norm.m

    r13646 r14182  
    224224if exist('mu','var') && exist('sigma','var')
    225225    for i=1:ncol
    226         dbelow(end+1)=normcdf(edges(  1),mu(i),sigma(i));
     226        dbelow(end+1)=normcdf_issm(edges(  1),mu(i),sigma(i));
    227227        dhistc(1:size(dhistc,1)-1,end+1)=...
    228             normcdf(edges(2:end  ),mu(i),sigma(i))-...
    229             normcdf(edges(1:end-1),mu(i),sigma(i));
    230         dabove(end+1)=norminv(edges(end),mu(i),sigma(i));
     228            normcdf_issm(edges(2:end  ),mu(i),sigma(i))-...
     229            normcdf_issm(edges(1:end-1),mu(i),sigma(i));
     230        dabove(end+1)=norminv_issm(edges(end),mu(i),sigma(i));
    231231        if exist('descr','var')
    232232            descr(end+1)={[descr{i} ' norm']};
  • issm/trunk-jpl/src/m/qmu/plot/plot_hist_norm_ci.m

    r13646 r14182  
    129129%  calculate 95% confidence intervals (same as dakota)
    130130        [mu(i),sigma(i),muci(:,i),sigmaci(:,i)]=...
    131             normfit(sampr(:,i),0.05);
     131            normfit_issm(sampr(:,i),0.05);
    132132    end
    133133    display('Using calculated normal fits.')
     
    191191if exist('mu','var') && exist('sigma','var')
    192192    for i=1:ncol
    193         dbelow(end+1)=normcdf(edges(  1),mu(i),sigma(i));
     193        dbelow(end+1)=normcdf_issm(edges(  1),mu(i),sigma(i));
    194194        dhistc(1:size(dhistc,1)-1,end+1)=...
    195             normcdf(edges(2:end  ),mu(i),sigma(i))-...
    196             normcdf(edges(1:end-1),mu(i),sigma(i));
    197         dabove(end+1)=norminv(edges(end),mu(i),sigma(i));
     195            normcdf_issm(edges(2:end  ),mu(i),sigma(i))-...
     196            normcdf_issm(edges(1:end-1),mu(i),sigma(i));
     197        dabove(end+1)=norminv_issm(edges(end),mu(i),sigma(i));
    198198        if exist('descr','var')
    199199            descr(end+1)={[descr{i} ' norm']};
     
    204204if exist('muci','var') && exist('sigmaci','var')
    205205    for i=1:ncol
    206         dbelow(end+1)=normcdf(edges(  1),muci(1,i),sigmaci(2,i));
     206        dbelow(end+1)=normcdf_issm(edges(  1),muci(1,i),sigmaci(2,i));
    207207        dhistc(1:size(dhistc,1)-1,end+1)=...
    208             normcdf(edges(2:end  ),muci(1,i),sigmaci(2,i))-...
    209             normcdf(edges(1:end-1),muci(1,i),sigmaci(2,i));
    210         dabove(end+1)=norminv(edges(end),muci(1,i),sigmaci(2,i));
     208            normcdf_issm(edges(2:end  ),muci(1,i),sigmaci(2,i))-...
     209            normcdf_issm(edges(1:end-1),muci(1,i),sigmaci(2,i));
     210        dabove(end+1)=norminv_issm(edges(end),muci(1,i),sigmaci(2,i));
    211211        if exist('descr','var')
    212212            descr(end+1)={[descr{i} ' norm-+']};
     
    214214    end
    215215    for i=1:ncol
    216         dbelow(end+1)=normcdf(edges(  1),muci(1,i),sigmaci(1,i));
     216        dbelow(end+1)=normcdf_issm(edges(  1),muci(1,i),sigmaci(1,i));
    217217        dhistc(1:size(dhistc,1)-1,end+1)=...
    218             normcdf(edges(2:end  ),muci(1,i),sigmaci(1,i))-...
    219             normcdf(edges(1:end-1),muci(1,i),sigmaci(1,i));
    220         dabove(end+1)=norminv(edges(end),muci(1,i),sigmaci(1,i));
     218            normcdf_issm(edges(2:end  ),muci(1,i),sigmaci(1,i))-...
     219            normcdf_issm(edges(1:end-1),muci(1,i),sigmaci(1,i));
     220        dabove(end+1)=norminv_issm(edges(end),muci(1,i),sigmaci(1,i));
    221221        if exist('descr','var')
    222222            descr(end+1)={[descr{i} ' norm--']};
     
    224224    end
    225225    for i=1:ncol
    226         dbelow(end+1)=normcdf(edges(  1),muci(2,i),sigmaci(1,i));
     226        dbelow(end+1)=normcdf_issm(edges(  1),muci(2,i),sigmaci(1,i));
    227227        dhistc(1:size(dhistc,1)-1,end+1)=...
    228             normcdf(edges(2:end  ),muci(2,i),sigmaci(1,i))-...
    229             normcdf(edges(1:end-1),muci(2,i),sigmaci(1,i));
    230         dabove(end+1)=norminv(edges(end),muci(2,i),sigmaci(1,i));
     228            normcdf_issm(edges(2:end  ),muci(2,i),sigmaci(1,i))-...
     229            normcdf_issm(edges(1:end-1),muci(2,i),sigmaci(1,i));
     230        dabove(end+1)=norminv_issm(edges(end),muci(2,i),sigmaci(1,i));
    231231        if exist('descr','var')
    232232            descr(end+1)={[descr{i} ' norm+-']};
     
    234234    end
    235235    for i=1:ncol
    236         dbelow(end+1)=normcdf(edges(  1),muci(2,i),sigmaci(2,i));
     236        dbelow(end+1)=normcdf_issm(edges(  1),muci(2,i),sigmaci(2,i));
    237237        dhistc(1:size(dhistc,1)-1,end+1)=...
    238             normcdf(edges(2:end  ),muci(2,i),sigmaci(2,i))-...
    239             normcdf(edges(1:end-1),muci(2,i),sigmaci(2,i));
    240         dabove(end+1)=norminv(edges(end),muci(2,i),sigmaci(2,i));
     238            normcdf_issm(edges(2:end  ),muci(2,i),sigmaci(2,i))-...
     239            normcdf_issm(edges(1:end-1),muci(2,i),sigmaci(2,i));
     240        dabove(end+1)=norminv_issm(edges(end),muci(2,i),sigmaci(2,i));
    241241        if exist('descr','var')
    242242            descr(end+1)={[descr{i} ' norm++']};
  • issm/trunk-jpl/src/m/qmu/plot/plot_normdist_bars.m

    r13646 r14182  
    126126if ~isfield(dresp,'mean') || ~isfield(dresp,'stddev')
    127127    for i=1:length(dresp)
    128         [dresp(i).mean,dresp(i).stddev]=normfit(dresp(i).sample);
     128        [dresp(i).mean,dresp(i).stddev]=normfit_issm(dresp(i).sample);
    129129    end
    130130end
     
    141141for i=1:length(dresp)
    142142    descr(i)=cellstr(dresp(i).descriptor);
    143     data(i,:)=norminv(prob,dresp(i).mean,dresp(i).stddev);
     143    data(i,:)=norminv_issm(prob,dresp(i).mean,dresp(i).stddev);
    144144end
    145145
  • issm/trunk-jpl/src/m/qmu/plot/plot_rlev_bars_ci.m

    r13646 r14182  
    133133        [dresp(i).mean,dresp(i).stddev,...
    134134         dresp(i).meanci,dresp(i).stddevci]=...
    135             normfit(sampr(:,i),0.05);
     135            normfit_issm(sampr(:,i),0.05);
    136136        display('Using calculated normal fits from sample data.')
    137137    end
     
    140140%  use minus/plus integer standard deviations
    141141        sdvect=[-4 -3 -2 -1 0 1 2 3 4];
    142         dresp(i).cdf(:,2)=normcdf(sdvect,0,1);
    143         dresp(i).cdf(:,1)=norminv(dresp(i).cdf(:,2),...
    144                                   dresp(i).mean,dresp(i).stddev);
     142        dresp(i).cdf(:,2)=normcdf_issm(sdvect,0,1);
     143        dresp(i).cdf(:,1)=norminv_issm(dresp(i).cdf(:,2),...
     144                                       dresp(i).mean,dresp(i).stddev);
    145145        display('Using integer standard deviations for percentages.')
    146146
     
    176176           isfield(dresp(i),'stddev') && ~isempty(dresp(i).stddev)
    177177            descr(end+1)=cellstr([dresp(i).descriptor ' norm']);
    178             cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).mean,dresp(i).stddev);
     178            cdfr(end+1,:)=norminv_issm(dresp(i).cdf(:,2),dresp(i).mean,dresp(i).stddev);
    179179        end
    180180        if isfield(dresp(i),'meanci'  ) && ~isempty(dresp(i).meanci  ) && ...
     
    184184            descr(end+1)=cellstr([dresp(i).descriptor ' norm+-']);
    185185            descr(end+1)=cellstr([dresp(i).descriptor ' norm++']);
    186             cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).meanci(1),dresp(i).stddevci(2));
    187             cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).meanci(1),dresp(i).stddevci(1));
    188             cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).meanci(2),dresp(i).stddevci(1));
    189             cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).meanci(2),dresp(i).stddevci(2));
     186            cdfr(end+1,:)=norminv_issm(dresp(i).cdf(:,2),dresp(i).meanci(1),dresp(i).stddevci(2));
     187            cdfr(end+1,:)=norminv_issm(dresp(i).cdf(:,2),dresp(i).meanci(1),dresp(i).stddevci(1));
     188            cdfr(end+1,:)=norminv_issm(dresp(i).cdf(:,2),dresp(i).meanci(2),dresp(i).stddevci(1));
     189            cdfr(end+1,:)=norminv_issm(dresp(i).cdf(:,2),dresp(i).meanci(2),dresp(i).stddevci(2));
    190190        end
    191191    end
Note: See TracChangeset for help on using the changeset viewer.