代码拉取完成,页面将自动刷新
function z=lhs_iman_n(xmean,xsd,corr)
% z=lhs_iman_n(xmean,xsd,corr,nsample,ntry)
% LHS with correlation, normal distribution
% Method of Iman & Conover
% using mchol for Cholesky decomposition so that corr. matrix is positive definite
%
% Iman, R. L., and W. J. Conover. 1982. A Distribution-free Approach to Inducing Rank Correlation
% Among Input Variables. Communications in Statistics B 11:311-334
%
% Input:
% xmean : mean of data (1,nvar)
% xsd : std.dev of data (1,nvar)
% corr : correlation matrix of the variables (nvar,nvar)
% nsample : no. of samples
% ntry : optional, no of trial to get a close correlation matrix
% Output:
% z : random sample (nsample,nvar)
% Budiman (2004)
% using mchol from Brian Borchers
nvar=length(xmean);
if(nargin==4), ntry=1; end;
% induce data with correlation
[L,D,E]=mchol(corr);
%P = chol(corr+E)';
P=L*sqrt(D);
xm=zeros(1,nvar);
xs=ones(1,nvar);
R=latin_hs(xm,xs,1,nvar);
T = corrcoef(R);
[L,D,E]=mchol(T);
%Q=chol(T+E)';
Q=L*sqrt(D);
S = P * inv(Q);
RB= R*S';
for j=1:nvar
% rank RB
[r,id]=ranking(RB(:,j));
% sort R
[RS,id]=sort(R(:,j));
% permute RS so has the same rank as RB
z(:,j) = RS(r).*xsd(j)+xmean(j);
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。