亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? corrcoef.m

?? matlab數字信號處理工具箱
?? M
字號:
function [R,sig,ci1,ci2,nan_sig] = corrcoef(X,Y,Mode);
% CORRCOEF calculates the correlation coefficient.
%   X and Y can contain missing values encoded with NaN.
%   NaN's are skipped, NaN do not result in a NaN output. 
%   It is garanteed that abs(R) is not larger than 1. 
%   A significance test to check the independence of NaN's
%   is included. 
%   R = CORRCOEF(X [,Mode]);
%      calculates the (auto-)correlation matrix of X
%   R = CORRCOEF(X,Y [,Mode]);
%      calculates the crosscorrelation between X and Y
%
% Mode='Pearson' or 'parametric' [default]
%	gives the correlation coefficient  
%	also known as the "product-moment coefficient of correlation" or "Pearson's correlation" [1]
% Mode='Spearman' 	gives "Spearman's Rank Correlation Coefficient"
%	This replaces SPEARMAN.M
% Mode='Rank' 		gives a nonparametric Rank Correlation Coefficient
%	This replaces RANKCORR.M
%
% The result is only valid if the occurence of NaN's is uncorrelated. 
%   This can be checked with 
%       [nan_R,nan_sig]=corrcoef(X,isnan(X))
%   or  [nan_R,nan_sig]=corrcoef([X,Y],isnan([X,Y]))
%   or  [R,p,ci1,ci2,nan_sig] = CORRCOEF(...);
%
% [R,p,ci1,ci2,nansig] = CORRCOEF(...);
% 	R is the correlation matrix
%	R(i,j) is the correlation coefficient r between X(:,i) and Y(:,j)
%  p    gives the significance of R
%	It tests the null hypothesis that the product moment correlation coefficient is zero 
%       using Student's t-test on the statistic t = r sqrt(N-2)/sqrt(1-r^2) 
%       where N is the number of samples (Statistics, M. Spiegel, Schaum series).
%  p > alpha: do not reject the Null hypothesis: "R is zero".
%  p < alpha: The alternative hypothesis "R2 is larger than zero" is true with probability (1-alpha).
%  ci1	lower 0.95 confidence interval 
%  ci2	upper 0.95 confidence interval 
%  nan_sig 	p-value whether H0: "NaN's are not correlated" could be correct
%       if nan_sig < alpha, H1 ("NaNs are correlated") is very likely. 
% 
% Further recommandation related to the correlation coefficient 
% + LOOK AT THE SCATTERPLOTS!
% + Correlation is not causation. The observed correlation between two variables 
%	might be due to the action of other, unobserved variables.
%
% see also: SUMSKIPNAN, COVM, COV, COR, SPEARMAN, RANKCORR, RANKS
%
% REFERENCES:
% on the correlation coefficient 
% [ 1] http://mathworld.wolfram.com/CorrelationCoefficient.html
% [ 2] http://www.geography.btinternet.co.uk/spearman.htm
% [ 3] Hogg, R. V. and Craig, A. T. Introduction to Mathematical Statistics, 5th ed.  New York: Macmillan, pp. 338 and 400, 1995.
% [ 4] Lehmann, E. L. and D'Abrera, H. J. M. Nonparametrics: Statistical Methods Based on Ranks, rev. ed. Englewood Cliffs, NJ: Prentice-Hall, pp. 292, 300, and 323, 1998.
% [ 5] Press, W. H.; Flannery, B. P.; Teukolsky, S. A.; and Vetterling, W. T. Numerical Recipes in FORTRAN: The Art of Scientific Computing, 2nd ed. Cambridge, England: Cambridge University Press, pp. 634-637, 1992
% [ 6] http://mathworld.wolfram.com/SpearmanRankCorrelationCoefficient.html
% on the significance test of the correlation coefficient
% [11] http://www.met.rdg.ac.uk/cag/STATS/corr.html
% [12] http://www.janda.org/c10/Lectures/topic06/L24-significanceR.htm
% [13] http://faculty.vassar.edu/lowry/ch4apx.html
% [14] http://davidmlane.com/hyperstat/B134689.html
% others
% [20] http://www.tufts.edu/~gdallal/corr.htm

%       $Revision: 1.29 $
%       $Id: corrcoef.m,v 1.29 2004/06/10 15:16:10 schloegl Exp $
%       Copyright (C) 2000-2003 by  Alois Schloegl <a.schloegl@ieee.org>	
%       This function is part of the NaN-toolbox
%       http://www.dpmi.tu-graz.ac.at/~schloegl/matlab/NaN/

%    This program is free software; you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation; either version 2 of the License, or
%    (at your option) any later version.
%
%    This program is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with this program; if not, write to the Free Software
%    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

% Features:
% + interprets NaN's as missing value
% + Pearson's correlation
% + Spearman's rank correlation
% + Rank correlation (non-parametric, non-Spearman)
% + is fast, using an efficient algorithm O(n.log(n)) for calculating the ranks
% + significance test for null-hypthesis: r=0 
% + confidence interval included
% - rank correlation works for cell arrays, too (no check for missing values).
% + compatible with Octave and Matlab
% + checks independence of missing values (NaNs) 


NARG = nargout;	% needed because nargout is not reentrant in Octave

if nargin==1
        Y = [];
        Mode='Pearson';
elseif nargin==0
        fprintf(2,'Error CORRCOEF: Missing argument(s)\n');
elseif nargin==2
        if ~isnumeric(Y)
                Mode=Y;
                Y=[];
        else
                Mode='Pearson';
        end;
end;        
Mode=[Mode,'        '];

FLAG_WARNING = warning;		% save warning status
warning('off');

[r1,c1]=size(X);
if ~isempty(Y)
        [r2,c2]=size(Y);
        if r1~=r2,
                fprintf(2,'Error CORRCOEF: X and Y must have the same number of observations (rows).\n');
                return;
        end;
        NN = real(~isnan(X)')*real(~isnan(Y));
else
        [r2,c2]=size(X);
        NN = real(~isnan(X)')*real(~isnan(X));  
end;

%%%%% generate combinations using indices for pairwise calculation of the correlation
YESNAN = any(isnan(X(:))) | any(isnan(Y(:)));
if isempty(Y),
        IX = ones(c1)-diag(ones(c1,1));
        [jx, jy ] = find(IX);
        [jxo,jyo] = find(IX);
	R = eye(c1);        
else
        IX = zeros(c1+c2);
        IX(1:c1,c1+(1:c2)) = 1;
        [jx,jy] = find(IX);
        
        IX = ones(c1,c2);
        [jxo,jyo] = find(IX);
	R = repmat(nan,c1,c2);
end;  

if strcmp(lower(Mode(1:7)),'pearson');
        % see http://mathworld.wolfram.com/CorrelationCoefficient.html
	if ~YESNAN,
                [S,N,SSQ] = sumskipnan(X,1);
                if ~isempty(Y),
	                [S2,N2,SSQ2] = sumskipnan(Y,1);
                        CC = X'*Y;
                        M1 = S./N;
                        M2 = S2./N2;
                        cc = CC./NN - M1'*M2;
                        R  = cc./sqrt((SSQ./N-M1.*M1)'*(SSQ2./N2-M2.*M2));
                else        
                        CC = X'*X;
                        M  = S./N;
                        cc = CC./NN - M'*M;
                        v  = SSQ./N - M.*M; %max(N-1,0);
                        R  = cc./sqrt(v'*v);
                end;
        else
                if ~isempty(Y),
                        X  = [X,Y];
                end;  
                for k = 1:length(jx),
                        %ik = ~any(isnan(X(:,[jx(k),jy(k)])),2);
                        ik = ~isnan(X(:,[jx(k)])) & ~isnan(X(:,[jy(k)]));
                        [s,n,s2] = sumskipnan(X(ik,[jx(k),jy(k)]),1);
                        v  = (s2-s.*s./n)./n;
                        cc = X(ik,jx(k))'*X(ik,jy(k));
                        cc = cc/n(1) - prod(s./n);
                        %r(k) = cc./sqrt(prod(v));
                        R(jxo(k),jyo(k)) = cc./sqrt(prod(v));
                end;
        end
        
elseif strcmp(lower(Mode(1:4)),'rank');
        % see [ 6] http://mathworld.wolfram.com/SpearmanRankCorrelationCoefficient.html
	if ~YESNAN,
                if isempty(Y)
	                R = corrcoef(ranks(X));
                else
                        R = corrcoef(ranks(X),ranks(Y));
                end;
        else
                if ~isempty(Y),
                        X = [X,Y];
                end;  
                for k = 1:length(jx),
                        %ik = ~any(isnan(X(:,[jx(k),jy(k)])),2);
                        ik = ~isnan(X(:,[jx(k)])) & ~isnan(X(:,[jy(k)]));
                        il = ranks(X(ik,[jx(k),jy(k)]));
                        R(jxo(k),jyo(k)) = corrcoef(il(:,1),il(:,2));
                end;
		X = ranks(X);
        end;
        
elseif strcmp(lower(Mode(1:8)),'spearman');
        % see [ 6] http://mathworld.wolfram.com/SpearmanRankCorrelationCoefficient.html
        if ~isempty(Y),
                X = [X,Y];
        end;  
        
        n = repmat(nan,c1,c2);
        
        if ~YESNAN,
                iy = ranks(X);	%  calculates ranks;
		                
                for k = 1:length(jx),
                        [R(jxo(k),jyo(k)),n(jxo(k),jyo(k))] = sumskipnan((iy(:,jx(k)) - iy(:,jy(k))).^2);	% NN is the number of non-missing values
                end;
        else
                for k = 1:length(jx),
                        %ik = ~any(isnan(X(:,[jx(k),jy(k)])),2);
                        ik = ~isnan(X(:,[jx(k)])) & ~isnan(X(:,[jy(k)]));
                        il = ranks(X(ik,[jx(k),jy(k)]));
                        % NN is the number of non-missing values
                        [R(jxo(k),jyo(k)),n(jxo(k),jyo(k))] = sumskipnan((il(:,1) - il(:,2)).^2);
                end;
		X = ranks(X);
        end;
        R = 1 - 6 * R ./ (n.*(n.*n-1));
        
elseif strcmp(lower(Mode(1:7)),'partial');
        fprintf(2,'Error CORRCOEF: use PARTCORRCOEF \n',Mode);
        
        return;
        
elseif strcmp(lower(Mode(1:7)),'kendall');
        fprintf(2,'Error CORRCOEF: mode ''%s'' not implemented yet.\n',Mode);
        
        return;
else
        fprintf(2,'Error CORRCOEF: unknown mode ''%s''\n',Mode);
end;

if (NARG<2), 
	warning(FLAG_WARNING); 	% restore warning status
        return;
end;


% CONFIDENCE INTERVAL
if exist('flag_implicit_significance')==2,
        alpha = flag_implicit_significance;
else
	alpha = 0.01;        
end;
% fprintf(1,'CORRCOEF: confidence interval is based on alpha=%f\n',alpha);


% SIGNIFICANCE TEST
tmp = 1 - R.*R;
tmp(tmp<0) = 0;		% prevent tmp<0 i.e. imag(t)~=0 
t   = R.*sqrt(max(NN-2,0)./tmp);

if exist('t_cdf')>1;
        sig = t_cdf(t,NN-2);
elseif exist('tcdf')>1;
        sig = tcdf(t,NN-2);
else
        fprintf('CORRCOEF: significance test not completed because of missing TCDF-function\n')
        sig = repmat(nan,size(R));
end;
sig  = 2 * min(sig,1 - sig);

if NARG<3, 
	warning(FLAG_WARNING); 	% restore warning status
        return;
end;


tmp = R;
%tmp(ix1 | ix2) = nan;		% avoid division-by-zero warning
z   = log((1+tmp)./(1-tmp))/2; 	% Fisher's z-transform; 
%sz = 1./sqrt(NN-3);		% standard error of z
sz  = sqrt(2)*erfinv(1-2*alpha)./sqrt(NN-3);		% confidence interval for alpha of z

ci1 = tanh(z-sz);
ci2 = tanh(z+sz);

%ci1(isnan(ci1))=R(isnan(ci1));	% in case of isnan(ci), the interval limits are exactly the R value 
%ci2(isnan(ci2))=R(isnan(ci2));

if (NARG<5) | ~YESNAN, 
        sig_nan = [];
	warning(FLAG_WARNING); 	% restore warning status
        return;
end;


%%%%% ----- check independence of NaNs (missing values) -----
%[nan_R,nan_sig,nan_ci1,nan_ci2] = corrcoef(X,isnan(X))
[nan_R, nan_sig] = corrcoef(X,isnan(X));

% remove diagonal elements, because these have not any meaning %
nan_sig(isnan(nan_R)) = nan;

if any(nan_sig(:) < alpha),
        tmp = nan_sig(:);			% Hack to skip NaN's in MIN(X)
        min_sig = min(tmp(~isnan(tmp))); 	% Necessary, because Octave returns NaN rather than min(X) for min(NaN,X) 
        fprintf(1,'CORRCOFF Warning: Missing Values (i.e. NaNs) are not independent of data (p-value=%f)\n', min_sig);
        fprintf(1,'   Its recommended to remove all samples with any missing value (NaN).\n');
        fprintf(1,'   In the following combinations the null-hypotheses (NaNs are uncorrelated) must be rejected.\n');
        [ix,iy] = find(nan_sig < alpha);
        disp([ix,iy])
end;

%%%%% ----- end of independence check ------

warning(FLAG_WARNING); 	% restore warning status
return;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一本到不卡精品视频在线观看| 国内久久婷婷综合| 欧美亚洲国产bt| 亚洲午夜在线电影| 欧美理论在线播放| 奇米精品一区二区三区在线观看一| 91麻豆精品国产无毒不卡在线观看| 日本视频一区二区| 2023国产一二三区日本精品2022| 国产一区二区三区四区五区美女 | 日日夜夜一区二区| 日韩视频123| 国产在线看一区| 中文字幕一区三区| 欧美色老头old∨ideo| 全部av―极品视觉盛宴亚洲| 久久久噜噜噜久噜久久综合| 99精品欧美一区二区三区小说 | 欧美精品电影在线播放| 精品在线一区二区| 国产精品久久二区二区| 欧美视频第二页| 极品尤物av久久免费看| 亚洲三级在线免费观看| 欧美妇女性影城| 成人激情动漫在线观看| 亚洲高清免费观看 | 亚洲综合激情另类小说区| 在线播放/欧美激情| 高清国产午夜精品久久久久久| 亚洲日韩欧美一区二区在线| 欧美一区午夜精品| 北岛玲一区二区三区四区 | 亚洲一区在线视频观看| 日韩欧美一区二区久久婷婷| jizz一区二区| 蜜桃av一区二区| 一区二区三区免费在线观看| 久久午夜国产精品| 欧美精品在线一区二区三区| 不卡视频免费播放| 性欧美大战久久久久久久久| 欧美电影免费观看完整版| 日本国产一区二区| 国产一区二区h| 亚洲电影视频在线| 日韩美女啊v在线免费观看| 欧美mv和日韩mv的网站| 色美美综合视频| 国产成人av资源| 日av在线不卡| 亚洲动漫第一页| 成人免费在线播放视频| 精品国精品自拍自在线| 欧美日韩一区二区三区不卡| 成人午夜激情视频| 激情深爱一区二区| 亚洲chinese男男1069| 日韩美女视频一区二区| 久久精品人人做人人综合| 日韩女优视频免费观看| 精品视频免费在线| 色乱码一区二区三区88| 成人av午夜电影| 国产成人精品免费网站| 精品一区二区三区在线观看国产| 日韩黄色免费网站| 亚洲一区二区三区视频在线| 一区二区三区在线高清| 国产精品欧美经典| 国产欧美一区二区在线观看| 久久网站最新地址| 精品对白一区国产伦| 精品日韩一区二区三区免费视频| 8v天堂国产在线一区二区| 欧美三区在线观看| 欧美区视频在线观看| 欧美日韩在线电影| 69av一区二区三区| 欧美日韩中文字幕一区| 日韩欧美国产不卡| 丰满白嫩尤物一区二区| 国产福利91精品一区二区三区| 国产一区91精品张津瑜| 国产精品自在欧美一区| 精品一区二区在线播放| 久久99精品一区二区三区| 黄色日韩网站视频| 国产又粗又猛又爽又黄91精品| 国产一区二区三区免费在线观看| 国产一区二区在线看| 国产成人综合亚洲网站| 国产高清精品网站| 不卡一区二区中文字幕| 99久久久无码国产精品| 欧美中文字幕一区二区三区亚洲| 欧美日韩在线播放三区四区| 91精品一区二区三区在线观看| 日韩欧美第一区| 久久久99精品免费观看| 一区二区中文字幕在线| 亚洲1区2区3区视频| 日韩中文字幕1| 国产在线播精品第三| 成人精品一区二区三区四区| 日本精品一区二区三区高清| 欧美日韩aaaaa| 精品88久久久久88久久久| 国产日韩欧美一区二区三区乱码 | 欧美aaaaa成人免费观看视频| 久久精品国产一区二区三 | 亚洲3atv精品一区二区三区| 另类小说视频一区二区| 成人av网站大全| 欧美色窝79yyyycom| 欧美变态tickling挠脚心| 国产精品护士白丝一区av| 午夜日韩在线观看| 国产精品中文字幕一区二区三区| 本田岬高潮一区二区三区| 欧美日韩午夜在线| 国产亚洲一本大道中文在线| 一区二区三区日韩精品视频| 精品一区二区在线视频| 欧洲国内综合视频| 久久精品水蜜桃av综合天堂| 亚洲大片免费看| 成人精品小蝌蚪| 欧美成人女星排行榜| 一区二区三区中文字幕| 国产一区二区三区蝌蚪| 欧美日韩黄色一区二区| 国产三区在线成人av| 日韩国产欧美三级| 91麻豆产精品久久久久久 | 欧美性大战久久久久久久蜜臀| 亚洲精品在线一区二区| 一区二区三区精品视频在线| 国产精品伊人色| 日韩一区二区在线看| 亚洲乱码日产精品bd| 国产jizzjizz一区二区| 欧美一区二区三区视频免费| 一区二区三区中文字幕| 成人免费黄色在线| 精品捆绑美女sm三区| 午夜伦欧美伦电影理论片| 91丨porny丨国产| 国产欧美一二三区| 国产制服丝袜一区| 欧美一区二区三区不卡| 亚洲图片自拍偷拍| 色香蕉成人二区免费| 中文字幕精品三区| 国产成都精品91一区二区三| 亚洲精品在线免费播放| 蜜桃精品在线观看| 日韩午夜在线影院| 日韩成人免费电影| 777久久久精品| 天天影视网天天综合色在线播放 | 国产成人精品亚洲777人妖 | 国产精品污污网站在线观看| 国产乱人伦偷精品视频免下载| 日韩一区二区免费在线电影| 青青草国产成人99久久| 欧美精品乱人伦久久久久久| 午夜激情一区二区| 51久久夜色精品国产麻豆| 亚洲一二三区不卡| 欧美主播一区二区三区美女| 亚洲香肠在线观看| 欧美日韩成人综合天天影院| 亚欧色一区w666天堂| 欧美精选在线播放| 久久国产精品无码网站| 26uuu精品一区二区在线观看| 精品一区二区三区免费观看 | 欧美日韩性生活| 天天操天天干天天综合网| 88在线观看91蜜桃国自产| 老司机免费视频一区二区| 欧美精品一区二区三区久久久| 国产精品一区二区黑丝| 国产精品九色蝌蚪自拍| 91成人在线免费观看| 五月婷婷激情综合| 亚洲精品在线观| 波多野结衣欧美| 亚洲香肠在线观看| 日韩精品一区二区三区四区视频| 国产一区二区三区av电影 | 亚洲国产美女搞黄色| 91精品国产欧美一区二区18| 久久精品国产亚洲5555| 久久久精品2019中文字幕之3| 97国产精品videossex| 亚洲成人一二三| 久久综合一区二区| 91在线观看免费视频|