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.00000000,
+0.709492564E-1,
+0.320949256
8+0.250000000,
+0.500000000,
+0.750000000,
+1.00000000
10+0.929050744,
+1.00000000,
+1.00000000,
+1.00000000
13+0.250000000,
+0.500000000,
+0.750000000,
+1.00000000
18call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
20+0.00000000,
+0.00000000,
+0.435317904,
+0.670611978
22+0.588235296E-1,
+0.235294119,
+0.764705896,
+1.00000000
24+0.388211519,
+0.564682126,
+1.00000000,
+1.00000000
28+1.00000000,
+3.00000000,
+9.00000000,
+4.00000000
29call setECDF(ecdf, rweight,
sum(rweight))
31+0.588235296E-1,
+0.235294119,
+0.764705896,
+1.00000000
38+0.00000000,
+0.00000000,
+0.00000000,
+0.581144691E-1,
+0.200971603,
+0.343828738,
+0.486685872
40+0.142857149,
+0.285714298,
+0.428571463,
+0.571428597,
+0.714285731,
+0.857142866,
+1.00000000
42+0.656171262,
+0.799028397,
+0.941885591,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000
45+0.142857149,
+0.285714298,
+0.428571463,
+0.571428597,
+0.714285731,
+0.857142866,
+1.00000000
49+5,
+3,
+9,
+5,
+1,
+3,
+5
50call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
52+0.00000000,
+0.141422749E-1,
+0.304464817,
+0.465755105,
+0.498013139,
+0.594787359,
+0.756077766
54+0.161290318,
+0.258064508,
+0.548387051,
+0.709677339,
+0.741935372,
+0.838709593,
+1.00000000
56+0.405212551,
+0.501986742,
+0.792309284,
+0.953599572,
+0.985857606,
+1.00000000,
+1.00000000
60+5.00000000,
+3.00000000,
+9.00000000,
+5.00000000,
+1.00000000,
+3.00000000,
+5.00000000
61call setECDF(ecdf, rweight,
sum(rweight))
63+0.161290318,
+0.258064508,
+0.548387051,
+0.709677339,
+0.741935372,
+0.838709593,
+1.00000000
70+0.00000000,
+0.00000000,
+0.709492564E-1,
+0.320949256
72+0.250000000,
+0.500000000,
+0.750000000,
+1.00000000
74+0.929050744,
+1.00000000,
+1.00000000,
+1.00000000
77+0.250000000,
+0.500000000,
+0.750000000,
+1.00000000
82call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
84+0.00000000,
+0.119542718,
+0.255906343,
+0.710451782
86+0.227272734,
+0.409090936,
+0.545454562,
+1.00000000
88+0.516820967,
+0.698639154,
+0.835002780,
+1.00000000
92+5.00000000,
+4.00000000,
+3.00000000,
+10.0000000
93call setECDF(ecdf, rweight,
sum(rweight))
95+0.227272734,
+0.409090936,
+0.545454562,
+1.00000000
102+0.00000000,
+0.00000000,
+0.00000000,
+0.581144691E-1,
+0.200971603,
+0.343828738,
+0.486685872
104+0.142857149,
+0.285714298,
+0.428571463,
+0.571428597,
+0.714285731,
+0.857142866,
+1.00000000
106+0.656171262,
+0.799028397,
+0.941885591,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000
109+0.142857149,
+0.285714298,
+0.428571463,
+0.571428597,
+0.714285731,
+0.857142866,
+1.00000000
113+5,
+3,
+4,
+9,
+10,
+9,
+5
114call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
116+0.00000000,
+0.00000000,
+0.642128587E-1,
+0.264212877,
+0.486435086,
+0.686435103,
+0.797546148
118+0.111111112,
+0.177777782,
+0.266666681,
+0.466666698,
+0.688888907,
+0.888888896,
+1.00000000
120+0.313564926,
+0.380231619,
+0.469120502,
+0.669120550,
+0.891342759,
+1.00000000,
+1.00000000
124+5.00000000,
+3.00000000,
+4.00000000,
+9.00000000,
+10.0000000,
+9.00000000,
+5.00000000
125call setECDF(ecdf, rweight,
sum(rweight))
127+0.111111112,
+0.177777782,
+0.266666681,
+0.466666698,
+0.688888907,
+0.888888896,
+1.00000000
134+0.00000000,
+0.00000000,
+0.00000000,
+0.00000000,
+0.102855057,
+0.213966161,
+0.325077266,
+0.436188370,
+0.547299504
136+0.111111112,
+0.222222224,
+0.333333343,
+0.444444448,
+0.555555582,
+0.666666687,
+0.777777791,
+0.888888896,
+1.00000000
138+0.563811660,
+0.674922764,
+0.786033869,
+0.897144973,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000
141+0.111111112,
+0.222222224,
+0.333333343,
+0.444444448,
+0.555555582,
+0.666666687,
+0.777777791,
+0.888888896,
+1.00000000
145+6,
+1,
+6,
+7,
+7,
+7,
+6,
+2,
+1
146call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
148+0.00000000,
+0.00000000,
+0.952170640E-1,
+0.258007765,
+0.420798481,
+0.583589196,
+0.723124087,
+0.769635737,
+0.792891443
150+0.139534891,
+0.162790701,
+0.302325606,
+0.465116322,
+0.627907038,
+0.790697753,
+0.930232644,
+0.976744294,
+1.00000000
152+0.346643448,
+0.369899243,
+0.509434164,
+0.672224879,
+0.835015595,
+0.997806311,
+1.00000000,
+1.00000000,
+1.00000000
156+6.00000000,
+1.00000000,
+6.00000000,
+7.00000000,
+7.00000000,
+7.00000000,
+6.00000000,
+2.00000000,
+1.00000000
157call setECDF(ecdf, rweight,
sum(rweight))
159+0.139534891,
+0.162790701,
+0.302325606,
+0.465116322,
+0.627907038,
+0.790697753,
+0.930232644,
+0.976744294,
+1.00000000
178call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
189call setECDF(ecdf, rweight,
sum(rweight))
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+7,
+8,
+2,
+1,
+3,
+1,
+7
210call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
212+0.00000000,
+0.265048236,
+0.334013730,
+0.368496507,
+0.471944779,
+0.506427526,
+0.747806907
214+0.241379306,
+0.517241359,
+0.586206853,
+0.620689631,
+0.724137902,
+0.758620679,
+1.00000000
216+0.493572414,
+0.769434452,
+0.838400006,
+0.872882724,
+0.976330996,
+1.00000000,
+1.00000000
220+7.00000000,
+8.00000000,
+2.00000000,
+1.00000000,
+3.00000000,
+1.00000000,
+7.00000000
221call setECDF(ecdf, rweight,
sum(rweight))
223+0.241379306,
+0.517241359,
+0.586206853,
+0.620689631,
+0.724137902,
+0.758620679,
+1.00000000
230+0.00000000,
+0.00000000,
+0.00000000,
+0.112224042,
+0.278890729,
+0.445557356
232+0.166666672,
+0.333333343,
+0.500000000,
+0.666666687,
+0.833333373,
+1.00000000
234+0.721109331,
+0.887776017,
+1.00000000,
+1.00000000,
+1.00000000,
+1.00000000
237+0.166666672,
+0.333333343,
+0.500000000,
+0.666666687,
+0.833333373,
+1.00000000
241+7,
+9,
+1,
+7,
+6,
+3
242call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
244+0.00000000,
+0.248433366,
+0.278736353,
+0.490857601,
+0.672675788,
+0.763584852
246+0.212121218,
+0.484848499,
+0.515151501,
+0.727272749,
+0.909090936,
+1.00000000
248+0.448536336,
+0.721263647,
+0.751566648,
+0.963687897,
+1.00000000,
+1.00000000
252+7.00000000,
+9.00000000,
+1.00000000,
+7.00000000,
+6.00000000,
+3.00000000
253call setECDF(ecdf, rweight,
sum(rweight))
255+0.212121218,
+0.484848499,
+0.515151501,
+0.727272749,
+0.909090936,
+1.00000000
262+0.00000000,
+0.00000000,
+0.215899706
264+0.333333343,
+0.666666687,
+1.00000000
266+1.00000000,
+1.00000000,
+1.00000000
269+0.333333343,
+0.666666687,
+1.00000000
274call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
276+0.200023800,
+0.611788511,
+0.670611978
278+0.529411793,
+0.941176534,
+1.00000000
280+0.858799815,
+1.00000000,
+1.00000000
284+9.00000000,
+7.00000000,
+1.00000000
285call setECDF(ecdf, rweight,
sum(rweight))
287+0.529411793,
+0.941176534,
+1.00000000
306call setECDF(ecdf, iweight,
sum(iweight), lcdf, ucdf)
317call setECDF(ecdf, rweight,
sum(rweight))
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.