代码拉取完成,页面将自动刷新
function s=latin_hs(xmean,xsd,nsample,nvar)
% s=latin_hs(xmean,xsd,nsample,nvar)
% LHS from normal distribution, no correlation
% method of Stein
% Stein, M. 1987. Large Sample Properties of Simulations Using Latin Hypercube Sampling.
% Technometrics 29:143-151
% Input:
% xmean : mean of data (1,nvar)
% xsd : std.dev of data (1,nvar)
% nsample : no. of samples
% nvar : no. of variables
% Output:
% s : random sample (nsample,nvar)
%
% Uses Peter Acklam inverse normal CDF
%
% Budiman (2003)
% References:
% Iman, R. L., and W. J. Conover. 1980. Small Sample Sensitivity Analysis Techniques for Computer Models,
% with an Application to Risk Assessment.Communications in Statistics: Theory and Methods A9: 1749-1874
% McKay, M. D., W. J. Conover and R. J. Beckman. 1979.A Comparison of Three Methods for Selecting Values
% of Input Variables in the Analysis of Output from a Computer Code. Technometrics 21: 239-245
%
ran=rand(nsample,nvar);
s=zeros(nsample,nvar);
% method of Stein
for j=1: nvar
idx=randperm(nsample);
P=(idx'-ran(:,j))/nsample; % probability of the cdf
s(:,j) = xmean(j) + ltqnorm(P).* xsd(j); % this can be replaced by any inverse distribution function
end
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。