Intersection algorithm: Difference between revisions

Content deleted Content added
No edit summary
 
m remove unnec whitespace
Line 9:
 
The intersection algorithm begins by creating a table of tuples <offset,type>. For each interval there are three entries, the lower endpoint, the midpoint and the upper endpoint, labelled with types -1, 0 1 respectively. Thus interval c +/- r results in entries <c-r,-1> <c,0> <c+r,+1>. These are then sorted by offset.
 
 
Variables: This algorithm uses ''f'' as number of false tickers, ''endcount'' and ''midcount' are integers. ''Lower'' and ''upper'' are values of offsets.
 
 
 
0) [initialize best f] Start with ''f''=0, assuming all input intervals are valid. Each time no interval is found f will be incremented until either an interval is found or ''f''>=''m''/2.
 
 
1) [initialize] ''endcount''=0 ''midcount''=0
Line 25 ⟶ 21:
 
4) [determine number of midpoints] Start from end of list and work towards lower offsets. ''endcount''=''endcount''+''type''. If ''endcount''>=''m''-''f'' then ''upper''=''offset'', goto step 5. If ''type''=0 then ''midcount''=''midcount''+1. Repeat for next tuple. If reach end of list then goto step 6.
 
 
5) if ''lower''<=''upper'' and ''midcount''<=''f'' then return interval [''lowerendpoint'',''upperendpoint''] as resulting confidence interval.