-
Notifications
You must be signed in to change notification settings - Fork 0
/
interval.Rpres
28 lines (20 loc) · 1.82 KB
/
interval.Rpres
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
The overlapping interval simulation
========================================================
author: Dung Nguyen
date: November 1, 2020
autosize: true
Sypnosis
========================================================
Draw *p* points between [0,1] (both 0 and 1 are counted in *p*) that are equally distanced and randomly draw *n* line segments (*n* > 1) that connect any 2 points from *p* points. What is the probability that there is at least 1 line segment that overlaps with all other line segments?
Solution
========================================================
I run simulation experiments and estimate the probability (with standard error). From *p* points between [0,1] (both 0 and 1 are counted in p points), I draw randomly *n* line segments (*n* > 1) that connect any 2 points. In order to do this, I picked *n* pairs of points from the *p* points. Rearrange within pairs so that the first point in a pair should be smaller or equal to the second point.
If there is one pair of points in which the first point is smaller or equal to the second point of all other pair, and the second point is larger or equal to the first point of all other pairs, than that line segment connects that pair of points overlaps with all other line segments from the rest pairs.
Estimation from Experiments
========================================================
- Randomly draw *n* pairs of points (*n* > 1) from *p* points (including 0 & 1).
- Check if any line segments generated by those pairs overlap with all other line segments
- Each random draw and check is an Experiment. Choose a sample of a few Experiments (default is 20) and calculate mean of probability from each sample of Experiments
- Repeat the above procedure for better estimation of mean of probability and its variance.
Thank you
========================================================