Compute and return the Empirical Cumulative Distribution Function (ECDF) of a univariate (optionally weighted) sample of size size(ecdf)
.
More...
Compute and return the Empirical Cumulative Distribution Function (ECDF) of a univariate (optionally weighted) sample of size size(ecdf)
.
- Parameters
-
[out] | ecdf | : The output contiguous array of rank 1 of
-
type
real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
of the same size nsam as the number of observations in the target sample whose ECDF must be computed.
On output, it contains the Empirical Cumulative Distribution Function (ECDF) of the input sample.
|
[in] | weight | : The input contiguous vector of length nsam of,
-
type
integer of default kind IK, or
-
type
real of the same kind as the kind of ecdf ,
containing the corresponding weights of individual nsam observations in the target sample.
(optional. default = getFilled(1, nsam).) |
[in] | weisum | : The input scalar of the same type and kind as weight containing the quantity sum(weight) .
(optional. It must be present if and only if the input argument weight is also present.) |
[out] | lcdf | : The output contiguous array of the same type, kind, rank, and size as the output ecdf containing the lower confidence bound on the ECDF as the specified \(1 - \alpha\) probability.
(optional, if missing, it is not computed. It can be present if and only if the input argument weight is missing or is of type integer of default kind IK.) |
[out] | ucdf | : The output contiguous array of the same type, kind, rank, and size as the output ecdf containing the upper confidence bound on the ECDF as the specified \(1 - \alpha\) probability.
(optional, if missing, it is not computed. It can be present if and only if the input argument weight is missing or is of type integer of default kind IK.) |
[in] | alpha | : The input scalar of type real of the same kind as the kind of ecdf such that \(1 - \alpha\) represents the probability of the parent CDF being bounded by the output upper and lower confidence bounds of the output ecdf.
For example, if \(\alpha = 0.05\), then the output lcdf and ucdf confidence bounds contain the CDF of the true parent distribution of the sample with \( 95\% \) probability.
In other words,
-
the lower bound marks the \(\alpha / 2\) probability contour.
-
the upper bound marks the \(1 - \alpha / 2\) probability contour.
(optional, default = 0.05 . It can be present if and only if the input argument weight is missing or is of type integer of default kind IK.) |
Possible calling interfaces ⛓
call setECDF(ecdf(
1 : nsam) , lcdf
= lcdf(
1 : nsam), ucdf
= ucdf(
1 : nsam), alpha
= alpha)
call setECDF(ecdf(
1 : nsam), weight(
1 : nsam), lcdf
= lcdf(
1 : nsam), ucdf
= ucdf(
1 : nsam), alpha
= alpha)
call setECDF(ecdf(
1 : nsam), weight(
1 : nsam))
!
Compute and return the Empirical Cumulative Distribution Function (ECDF) of a univariate (optionally ...
This module contains classes and procedures for computing the Empirical Cumulative Distribution Funct...
- Warning
- The
pure
procedure(s) documented herein become impure
when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1
.
By default, these procedures are pure
in release
build and impure
in debug
and testing
builds.
- See also
- getCumSum
setCumSum
getCumPropExp
setCumPropExp
Example usage ⛓
15 type(display_type) :: disp
16 integer(IK) :: itry, ntry
= 10
21 real(RKG),
allocatable :: ecdf(:), lcdf(:), ucdf(:)
22 integer(IK),
allocatable :: iweight(:)
23 real(RKG),
allocatable :: rweight(:)
25 call disp%show(
"call setResized(ecdf, getUnifRand(1_IK, 10_IK))")
27 call disp%show(
"call setResized(lcdf, size(ecdf, 1, IK))")
29 call disp%show(
"call setResized(ucdf, size(ecdf, 1, IK))")
31 call disp%show(
"call setECDF(ecdf, lcdf, ucdf)")
44 call disp%show(
"iweight = getUnifRand(1, 10, size(ecdf, 1, IK))")
48 call disp%show(
"call setECDF(ecdf, iweight, sum(iweight), lcdf, ucdf)")
49 call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
61 call disp%show(
"call setECDF(ecdf, rweight, sum(rweight))")
62 call setECDF(ecdf, rweight,
sum(rweight))
77 character(:, SK),
allocatable :: fileName
78 real(RKG),
allocatable :: sample(:), ecdf(:), lcdf(:), ucdf(:)
79 integer(IK) :: i, isam, nsam
80 integer(IK) :: fileUnit
89 call setECDF(ecdf, lcdf, ucdf, alpha
= 0.98_RKG)
90 fileName
= "main.norm." // getStr(nsam)
// ".out"
91 open(newunit
= fileUnit, file
= fileName, status
= "replace")
92 write(fileUnit,
"(*(g0,:,','))")
"sample,ecdf,lcdf,ucdf"
94 write(fileUnit,
"(*(g0,:,','))") sample(isam), ecdf(isam), lcdf(isam), ucdf(isam)
Generate minimally-spaced character, integer, real sequences or sequences at fixed intervals of size ...
Allocate or resize (shrink or expand) an input allocatable scalar string or array of rank 1....
Perform an unbiased random shuffling of the input array, known as the Knuth or Fisher-Yates shuffle,...
Sort the input scalar string or contiguous vector in ascending order, or return the sorted indices of...
Return a scalar or array of arbitrary rank of random values from the standard univariate Normal distr...
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
Generate and return the conversion of the input value to an output Fortran string,...
This module contains procedures and generic interfaces for generating ranges of discrete character,...
This module contains procedures and generic interfaces for resizing allocatable arrays of various typ...
This module contains procedures and generic interfaces for shuffling arrays of various types.
This module contains procedures and generic interfaces for various sorting tasks.
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter IKS
The single-precision integer kind in Fortran mode. On most platforms, this is a 32-bit integer kind.
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
This module contains the generic procedures for converting values of different types and kinds to For...
Generate and return an object of type display_type.
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example output ⛓
6+0.00000000,
+0.396772027E-1
8+0.500000000,
+1.00000000
10+1.00000000,
+1.00000000
13+0.500000000,
+1.00000000
18call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
20+0.226880610,
+0.590516984
22+0.636363626,
+1.00000000
24+1.00000000,
+1.00000000
28+7.00000000,
+4.00000000
29call setECDF(ecdf, rweight,
sum(rweight))
31+0.636363626,
+1.00000000
38+0.00000000,
+0.00000000,
+0.00000000,
+0.00000000,
+0.102855057,
+0.213966161,
+0.325077266,
+0.436188370,
+0.547299504
40+0.111111112,
+0.222222224,
+0.333333343,
+0.444444448,
+0.555555582,
+0.666666687,
+0.777777791,
+0.888888896,
+1.00000000
42+0.563811660,
+0.674922764,
+0.786033869,
+0.897144973,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000
45+0.111111112,
+0.222222224,
+0.333333343,
+0.444444448,
+0.555555582,
+0.666666687,
+0.777777791,
+0.888888896,
+1.00000000
49+9,
+5,
+7,
+3,
+9,
+6,
+4,
+6,
+3
50call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
52+0.00000000,
+0.808959752E-1,
+0.215511367,
+0.273203671,
+0.446280599,
+0.561665237,
+0.638588309,
+0.753972948,
+0.811665177
54+0.173076928,
+0.269230783,
+0.403846174,
+0.461538494,
+0.634615421,
+0.750000060,
+0.826923132,
+0.942307770,
+1.00000000
56+0.361411750,
+0.457565606,
+0.592180967,
+0.649873316,
+0.822950244,
+0.938334882,
+1.00000000,
+1.00000000,
+1.00000000
60+9.00000000,
+5.00000000,
+7.00000000,
+3.00000000,
+9.00000000,
+6.00000000,
+4.00000000,
+6.00000000,
+3.00000000
61call setECDF(ecdf, rweight,
sum(rweight))
63+0.173076928,
+0.269230783,
+0.403846174,
+0.461538494,
+0.634615421,
+0.750000060,
+0.826923132,
+0.942307770,
+1.00000000
70+0.00000000,
+0.00000000,
+0.00000000,
+0.198386014E-1,
+0.144838601,
+0.269838601,
+0.394838601,
+0.519838572
72+0.125000000,
+0.250000000,
+0.375000000,
+0.500000000,
+0.625000000,
+0.750000000,
+0.875000000,
+1.00000000
74+0.605161428,
+0.730161428,
+0.855161428,
+0.980161428,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000
77+0.125000000,
+0.250000000,
+0.375000000,
+0.500000000,
+0.625000000,
+0.750000000,
+0.875000000,
+1.00000000
81+4,
+9,
+2,
+6,
+2,
+9,
+3,
+6
82call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
84+0.00000000,
+0.104973346,
+0.153753847,
+0.300095290,
+0.348875791,
+0.568387985,
+0.641558647,
+0.787900209
86+0.975609720E-1,
+0.317073166,
+0.365853667,
+0.512195110,
+0.560975611,
+0.780487776,
+0.853658497,
+1.00000000
88+0.309660792,
+0.529173017,
+0.577953458,
+0.724294901,
+0.773075461,
+0.992587566,
+1.00000000,
+1.00000000
92+4.00000000,
+9.00000000,
+2.00000000,
+6.00000000,
+2.00000000,
+9.00000000,
+3.00000000,
+6.00000000
93call setECDF(ecdf, rweight,
sum(rweight))
95+0.975609720E-1,
+0.317073166,
+0.365853667,
+0.512195110,
+0.560975611,
+0.780487776,
+0.853658497,
+1.00000000
102+0.00000000,
+0.00000000,
+0.709492564E-1,
+0.320949256
104+0.250000000,
+0.500000000,
+0.750000000,
+1.00000000
106+0.929050744,
+1.00000000,
+1.00000000,
+1.00000000
109+0.250000000,
+0.500000000,
+0.750000000,
+1.00000000
114call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
116+0.144453645E-1,
+0.389445364,
+0.681112051,
+0.722778678
118+0.291666687,
+0.666666687,
+0.958333373,
+1.00000000
120+0.568888009,
+0.943888009,
+1.00000000,
+1.00000000
124+7.00000000,
+9.00000000,
+7.00000000,
+1.00000000
125call setECDF(ecdf, rweight,
sum(rweight))
127+0.291666687,
+0.666666687,
+0.958333373,
+1.00000000
134+0.00000000,
+0.00000000,
+0.00000000,
+0.581144691E-1,
+0.200971603,
+0.343828738,
+0.486685872
136+0.142857149,
+0.285714298,
+0.428571463,
+0.571428597,
+0.714285731,
+0.857142866,
+1.00000000
138+0.656171262,
+0.799028397,
+0.941885591,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000
141+0.142857149,
+0.285714298,
+0.428571463,
+0.571428597,
+0.714285731,
+0.857142866,
+1.00000000
145+2,
+4,
+6,
+7,
+2,
+5,
+3
146call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
148+0.00000000,
+0.00000000,
+0.161599964,
+0.402979285,
+0.471944779,
+0.644358635,
+0.747806907
150+0.689655170E-1,
+0.206896544,
+0.413793087,
+0.655172408,
+0.724137902,
+0.896551728,
+1.00000000
152+0.321158648,
+0.459089667,
+0.665986180,
+0.907365561,
+0.976330996,
+1.00000000,
+1.00000000
156+2.00000000,
+4.00000000,
+6.00000000,
+7.00000000,
+2.00000000,
+5.00000000,
+3.00000000
157call setECDF(ecdf, rweight,
sum(rweight))
159+0.689655170E-1,
+0.206896544,
+0.413793087,
+0.655172408,
+0.724137902,
+0.896551728,
+1.00000000
166+0.00000000,
+0.00000000,
+0.00000000,
+0.112224042,
+0.278890729,
+0.445557356
168+0.166666672,
+0.333333343,
+0.500000000,
+0.666666687,
+0.833333373,
+1.00000000
170+0.721109331,
+0.887776017,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000
173+0.166666672,
+0.333333343,
+0.500000000,
+0.666666687,
+0.833333373,
+1.00000000
177+5,
+6,
+2,
+4,
+3,
+8
178call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
180+0.00000000,
+0.136200100,
+0.207628667,
+0.350485802,
+0.457628667,
+0.743342936
182+0.178571433,
+0.392857164,
+0.464285731,
+0.607142866,
+0.714285731,
+1.00000000
184+0.435228497,
+0.649514198,
+0.720942795,
+0.863799930,
+0.970942795,
+1.00000000
188+5.00000000,
+6.00000000,
+2.00000000,
+4.00000000,
+3.00000000,
+8.00000000
189call setECDF(ecdf, rweight,
sum(rweight))
191+0.178571433,
+0.392857164,
+0.464285731,
+0.607142866,
+0.714285731,
+1.00000000
198+0.00000000,
+0.00000000,
+0.00000000,
+0.581144691E-1,
+0.200971603,
+0.343828738,
+0.486685872
200+0.142857149,
+0.285714298,
+0.428571463,
+0.571428597,
+0.714285731,
+0.857142866,
+1.00000000
202+0.656171262,
+0.799028397,
+0.941885591,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000
205+0.142857149,
+0.285714298,
+0.428571463,
+0.571428597,
+0.714285731,
+0.857142866,
+1.00000000
209+3,
+7,
+8,
+5,
+9,
+10,
+7
210call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
212+0.00000000,
+0.100671202E-1,
+0.173332438,
+0.275373280,
+0.459046781,
+0.663128436,
+0.805985510
214+0.612244904E-1,
+0.204081625,
+0.367346942,
+0.469387770,
+0.653061271,
+0.857142925,
+1.00000000
216+0.255239010,
+0.398096144,
+0.561361432,
+0.663402259,
+0.847075760,
+1.00000000,
+1.00000000
220+3.00000000,
+7.00000000,
+8.00000000,
+5.00000000,
+9.00000000,
+10.0000000,
+7.00000000
221call setECDF(ecdf, rweight,
sum(rweight))
223+0.612244904E-1,
+0.204081625,
+0.367346942,
+0.469387770,
+0.653061271,
+0.857142925,
+1.00000000
230+0.00000000,
+0.00000000,
+0.00000000,
+0.00000000,
+0.102855057,
+0.213966161,
+0.325077266,
+0.436188370,
+0.547299504
232+0.111111112,
+0.222222224,
+0.333333343,
+0.444444448,
+0.555555582,
+0.666666687,
+0.777777791,
+0.888888896,
+1.00000000
234+0.563811660,
+0.674922764,
+0.786033869,
+0.897144973,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000
237+0.111111112,
+0.222222224,
+0.333333343,
+0.444444448,
+0.555555582,
+0.666666687,
+0.777777791,
+0.888888896,
+1.00000000
241+4,
+7,
+3,
+2,
+6,
+3,
+4,
+6,
+6
242call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
244+0.00000000,
+0.561928451E-1,
+0.129363567,
+0.178144068,
+0.324485511,
+0.397656232,
+0.495217174,
+0.641558647,
+0.787900209
246+0.975609720E-1,
+0.268292665,
+0.341463387,
+0.390243888,
+0.536585331,
+0.609756052,
+0.707316995,
+0.853658438,
+1.00000000
248+0.309660792,
+0.480392486,
+0.553563237,
+0.602343678,
+0.748685122,
+0.821855903,
+0.919416785,
+1.00000000,
+1.00000000
252+4.00000000,
+7.00000000,
+3.00000000,
+2.00000000,
+6.00000000,
+3.00000000,
+4.00000000,
+6.00000000,
+6.00000000
253call setECDF(ecdf, rweight,
sum(rweight))
255+0.975609720E-1,
+0.268292665,
+0.341463387,
+0.390243888,
+0.536585331,
+0.609756052,
+0.707316995,
+0.853658438,
+1.00000000
262+0.00000000,
+0.00000000,
+0.00000000,
+0.112224042,
+0.278890729,
+0.445557356
264+0.166666672,
+0.333333343,
+0.500000000,
+0.666666687,
+0.833333373,
+1.00000000
266+0.721109331,
+0.887776017,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000
269+0.166666672,
+0.333333343,
+0.500000000,
+0.666666687,
+0.833333373,
+1.00000000
273+3,
+10,
+9,
+5,
+10,
+2
274call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
276+0.00000000,
+0.115863055,
+0.346632302,
+0.474837422,
+0.731247663,
+0.782529712
278+0.769230798E-1,
+0.333333343,
+0.564102590,
+0.692307711,
+0.948717952,
+1.00000000
280+0.294393361,
+0.550803661,
+0.781572878,
+0.909777999,
+1.00000000,
+1.00000000
284+3.00000000,
+10.0000000,
+9.00000000,
+5.00000000,
+10.0000000,
+2.00000000
285call setECDF(ecdf, rweight,
sum(rweight))
287+0.769230798E-1,
+0.333333343,
+0.564102590,
+0.692307711,
+0.948717952,
+1.00000000
294+0.00000000,
+0.00000000,
+0.00000000,
+0.192638516,
+0.392638505
296+0.200000003,
+0.400000006,
+0.600000024,
+0.800000012,
+1.00000000
298+0.807361484,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000
301+0.200000003,
+0.400000006,
+0.600000024,
+0.800000012,
+1.00000000
306call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
308+0.00000000,
+0.128379673,
+0.248379678,
+0.368379682,
+0.728379726
310+0.239999995,
+0.399999976,
+0.519999981,
+0.639999986,
+1.00000000
312+0.511620283,
+0.671620250,
+0.791620255,
+0.911620259,
+1.00000000
316+6.00000000,
+4.00000000,
+3.00000000,
+3.00000000,
+9.00000000
317call setECDF(ecdf, rweight,
sum(rweight))
319+0.239999995,
+0.399999976,
+0.519999981,
+0.639999986,
+1.00000000
Visualization of the example output ⛓
- Test:
- test_pm_sampleECDF
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
-
If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
-
If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
- Copyright
- Computational Data Science Lab
- Author:
- Amir Shahmoradi, April 21, 2017, 1:54 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas Austin
Definition at line 151 of file pm_sampleECDF.F90.