Question

I computed CDF of my empirical distribution using ecdf() function in Matlab for a distribution with 10,000 values. However, the output that I get from it contains only 9967 values. How can I get total 10,000 values for my CDF? Thanks.

Was it helpful?

Solution

From a distribution with 10'000 values you'd expect an output of length 10'001. Most likely, your distribution contains 44 NaNs, or duplicate values. The former you check with sum(isnan(data(:)), the latter with length(unique(data(:)).

>> out = ecdf(1:5)
out =
         0
    0.2000
    0.4000
    0.6000
    0.8000
    1.0000
>> length(out)
ans =
     6
>> out = ecdf([1:5,NaN,NaN])
out =
         0
    0.2000
    0.4000
    0.6000
    0.8000
    1.0000
>> length(out)
ans =
     6
>> out = ecdf([1:5,5,5])
out =
         0
    0.1429
    0.2857
    0.4286
    0.5714
    1.0000
>> length(out)
ans =
     6
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top