⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kstest.m

📁 kriging算法
💻 M
字号:
function [d, prob] = kstest (data) 

%	   [d, prob] = kstest (data) 
%
%	KOLMOGOROV-SMIRNOV ONE SAMPLE TEST 
%	USING STANDARD NORMAL DISTRIBUTION
%
% Function based on the ksone.f Fortran Numerical Recipes routine.
% The ksone.f subroutine has been modified to be linked with the 
% matlab environment through ksoneg.f.
%
% data: variable samples
% d:    K-S statistique D corresponding to the maximum difference
%	between the sample distribution and the normat distribution
% prob: significance level of d.  Small values of prob show that the 
%	cumulative sample distribution is significantly different 
% 	from the normal one.
%
% Critical values of d are given in TABLE B (page 404) of 
% Legendre, L. and P. Legendre (1983). Numerical Ecology. Elsevier, Amsterdam, 419 p.
%
% To see what the sample ditribution looks like: hist(data);
%
% C. Lafleur 16/08/96

% Standardisation of the sampled variable (data)

  x = (data - mean(data)) / std(data);

% Sort data by ascending order

  y = sort(x);

% Calculation of the cumulative normal distribution corresponding to y

  l = length(y);
  k = 1 / sqrt(2*pi);

  for i = 1:l
    xx = (-10:0.01:y(i));
    yy  = exp(-(xx.^2)/2);
    t(i) = k .* trapz(xx,yy);
  end

% Kolmogorov-Smirnov Test

  [d, prob] = ksone (y(:),l,t(:));
  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -