What are real-world use cases for start-exclusive ranges/intervals?

75 Views Asked by At

Having a continuous range that is start-inclusive and end-exclusive is helpful for bucketing, binning, and histograms. There are countless cases for continuous ranges that are start-inclusive and end-inclusive (defining the span of a graph axis, an acceptable range of values, etc).

But what about ranges that are start-exclusive/end-inclusive or start-exclusive/end-exclusive? Are there real-world applications for those? Can you list any applications in practical mathematical modeling, statistics, machine learning, industry, etc?

1

There are 1 best solutions below

0
On BEST ANSWER

Examples: Here are test scores from a statistics class with 50 students, sorted in order of increasing size. (Brackets [] give the index of the first number printed on each row.)

sort(x)
 [1] 78 79 80 81 81 81 81 82 82 82 82 83 83 83 83 84 84 84 84 85
[21] 85 85 85 85 85 85 85 86 86 86 86 86 86 87 87 88 88 88 89 89
[41] 89 90 90 90 90 91 91 91 91 93

Below are four frequency histograms of the data. All might be considered reasonable for various purposes. The first histogram uses the default binning programmed into R. The binning of each of the other three is shown by the br parameter: first endpoint, last endpoint, and interval width. R uses intervals of type $(a,b],$ unless otherwise instructed. (Bins of the last histogram correspond to letter grades.)

The rug procedure indicates which numerical values are present in the sample (There are not 50 tick marks because of ties.) R tends to label the x-axis with round numbers, even if they are not exact bin boundaries.

 par(mfrow=c(2,2));  hdr = "Fifty Test Scores"  # 'par' permits 4 panels per plot
  hist(x, col="skyblue2", main=hdr);  rug(x)
  hist(x, br = seq(77.5, 93.5, by=1), col="skyblue2", main=hdr); rug(x)
  hist(x, br = seq(75, 95, by=5), col="skyblue2", main=hdr); rug(x)
  hist(x, br = seq(74.5, 94.5, by=5), col="skyblue2", main=hdr); rug(x)
par(mfrow=c(1,1))  # return to single-panel plots

enter image description here