Kolmogorov-Smirnov random numbers
x = distfun_ksrnd(N) x = distfun_ksrnd(N,[m,n]) x = distfun_ksrnd(N,m,n)
a matrix of doubles , the number of observations. N belongs to the set {1,2,3,4,.......,2147483647}
a 1-by-1 matrix of floating point integers, the number of rows of x
a 1-by-1 matrix of floating point integers, the number of columns of x
a matrix of doubles, the random numbers, x in [0,1]
Generates random variables from the Kolmogorov-Smirnov distribution function.
Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.
x = distfun_ksrnd(10) // Check x = distfun_ksrnd(N,v) x = distfun_ksrnd(100,[4 5]) // Check actual distribution N=10; K=10000; h=scf(); x=distfun_ksrnd(N,1,K); histplot(20,x); x=linspace(0,1); y=distfun_kspdf(x,N); plot(x,y,"b-") xtitle("Kolmogorov Smirnov Random Numbers","X","Density") legend(["Empirical","Exact"]); // Compare empirical CDF with exact CDF N=10; K=10000; y=1:K; y=y/K; x=distfun_ksrnd(N,[1,K]); x=gsort(x,"g","i"); scf(); plot(x,y,"r-"); x=linspace(0,1); p=distfun_kscdf(x,N); plot(x,p,"b-"); legend(["Empirical","Exact"]); xtitle("Kolmogorov-Smirnov Distribution","x","P(X<x)"); | ![]() | ![]() |
http://en.wikipedia.org/wiki/Binomial_distribution