Changeset 14325
- Timestamp:
- 02/07/13 15:28:41 (12 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/miscellaneous/normfit_issm.m
r14182 r14325 4 4 function [muhat,sigmahat,muci,sigmaci]=normfit_issm(x,alpha) 5 5 6 if ~exist('alpha','var') 7 alpha=0.05; 8 end 9 6 10 % remove any NaN 7 11 8 x=x(~isnan(x(:))); 9 n=length(x); 12 if find(isnan(x)) 13 muhat =zeros(1,size(x,2)); 14 sigmahat=zeros(1,size(x,2)); 15 muci =zeros(2,size(x,2)); 16 sigmaci =zeros(2,size(x,2)); 17 for j=1:size(x,2) 18 [muhat(j),sigmahat(j),muci(:,j),sigmaci(:,j)]=normfit_issm(x(~isnan(x(:,j)),j),alpha); 19 end 20 return 21 end 10 22 11 23 % explicitly calculate the moments … … 15 27 16 28 if (nargout>2) 17 if ~exist('alpha','var')18 alpha=0.05;19 end20 29 prob=1.-alpha/2.; 21 30 31 if (size(x,1) == 1) 32 % operate like matlab normfit, mean, std, etc. 33 n=length(x); 34 else 35 n=size(x,1); 36 end 37 38 muci =zeros(2,length(muhat )); 39 sigmaci =zeros(2,length(sigmahat)); 40 22 41 try 23 muci(1, 1) =muhat-tinv(prob,n-1)*sigmahat/sqrt(n);24 muci(2, 1) =muhat+tinv(prob,n-1)*sigmahat/sqrt(n);25 sigmaci(1, 1)=sigmahat*sqrt((n-1)/chi2inv(prob ,n-1));26 sigmaci(2, 1)=sigmahat*sqrt((n-1)/chi2inv(1.-prob,n-1));42 muci(1,:) =muhat-tinv(prob,n-1)*sigmahat/sqrt(n); 43 muci(2,:) =muhat+tinv(prob,n-1)*sigmahat/sqrt(n); 44 sigmaci(1,:)=sigmahat*sqrt((n-1)/chi2inv(prob ,n-1)); 45 sigmaci(2,:)=sigmahat*sqrt((n-1)/chi2inv(1.-prob,n-1)); 27 46 catch me 28 muci(1, 1) =muhat;29 muci(2, 1) =muhat;30 sigmaci(1, 1)=sigmahat;31 sigmaci(2, 1)=sigmahat;47 muci(1,:) =muhat; 48 muci(2,:) =muhat; 49 sigmaci(1,:)=sigmahat; 50 sigmaci(2,:)=sigmahat; 32 51 end 33 52 end -
issm/trunk-jpl/src/m/qmu/dakota_out_parse.m
r14324 r14325 198 198 % since normfit doesn't have a dim argument, and matlab isvector is true 199 199 % for a 1xn matrix, handle the case of one row explicitly 200 if ( min(size(data)) ==1)200 if (size(data,1) > 1) 201 201 %dmean =mean (data); 202 202 %dstddev=std (data,0); … … 224 224 225 225 % divide the data into structures for consistency 226 226 227 for i=1:length(desc) 227 228 dresp(i).descriptor=char(desc(i));
Note:
See TracChangeset
for help on using the changeset viewer.