Notes:Distribution of the sample median

From Maths
Jump to: navigation, search

Findings

I've found results for two sample sizes, n=3 and n=5, they are respectively:

  • F(r)2[32F(r)] for n=3, and
  • F(r)3[1015F(r)+6F(r)2] for n=5
    • I've experimentally verified this one
  • F(r)4(20F(r)3+70F(r)284F(r)+35) for n=7

Unfortunately it seems prior results are of no help

  • F(r)5(70F(r)4315F(r)3+540F(r)2420F(r)+126) PREDICTED for n=9

Important results

  1. P[Median(X1,,X2m+1)r]=P[X1Xm+1r | X1X2m+1]
    =P[X1Xm+1Min(r,Xm+2)Xm+2Xm+3X2m+1]1(2m+1)!
    =((2m+1)!)P[X1Xm+1Min(r,Xm+2)Xm+2Xm+3X2m+1]
    =limt+(((2m+1)!)P[X1Xm+1Min(r,Xm+2)Xm+2Xm+3X2m+1t])
    =(2m+1)!m!limt+[tf(x2m+1)(x2m+1f(x2m)(xm+3f(xm+2)(Min(r,xm+2)f(xm+1)F(xm+1)mdxm+1)dxm+2)dx2m)dx2m+1]

Problem overview

Let X1,,X2m+1 be a sample from a population X, meaning that the Xi are i.i.d random variables, for some mN0. We wish to find:

  • P[Median(X1,,X2m+1)r]
    - the Template:Cdf of the median.

Initial work

Since the variables are independent then any ordering is as likely as any other (which I proved the long way, rather than just jumping to 1(2m+1)!

- silly me) however the result, found in Probability of i.i.d random variables being in an order and not greater than something will be useful.


I believe the P[Median(X1,,X2m+1)r]=P[X1Xm+1r | X1X2m+1]. Let us make some definitions to make this shorter.

  • O:=X1X2m+1 - representing the order part
  • M:=X1Xm+1r - representing the median part
  • Q:=P[Median(X1,,X2m+1)r]=P[M | O] - representing the question


We should also have some sort of converse, related to rXm+2X2m+1 or something.


We also have:

Analysis

Let us look at Xr and XY to see what we can say if both are true (the "and")

  • Claim: (XrXY)(XMin(r,Y))
  • Proof:
      1. Suppose rY, so Min(r,Y)=r, obviously Xr  Xr=Min(r,Y), so the implication holds in this case
      2. Suppose Yr, so Min(r,Y)=Y, obviously XY  XY=Min(r,Y), so the implication holds in this case too.
      • We notice either Min(r,Y)=r if rY, or Min(r,Y)=Y if Yr (slightly modify the language for the equality, it doesn't matter though really)
        • Thus if rY then Xr and as rY by assumption, we use the transitivity of to see XrY thus XY too - as required
        • Thus if Yr then XY and as Yr by assumption, we use the transitivity of to see XYr and thus Xr too - as required.
      • So in either case, we have XY and Xr - as required

Problem statement

Thus we really want to find:

  • P[Median(X1,,X2m+1)r]=P[X1Xm+1r | X1X2m+1]
    =P[M and O]P[O]
    =((2m+1)!)P[X1Xm+1Min(r,Xm+2)Xm+2Xm+3X2m+1]
    • Caveat:We now need: (XrXYZ)(XMin(r,Y)YZ)
      to justify this format. Although that's arguably not that helpful for the integral.

Initial integral

This isn't about the median specifically, this is just looking at the specific integral.

Suppose we have a sample of length 3, X,Y,Z then we are looking at:

  • P[XMin(r,Y)YZt] (where t will be used for a limit towards to get P[XMin(r,Y)YZ] in the end), or as an integral:
    • tf(z)(zf(y)(Min(r,y)f(x)dx)dy)dz
      • if t>r then the minimum will get involved (for some zs anyway) and limit it to r, otherwise it'll always stay under r - of course in practice (as we'll take t) this will certainly happen.

Progression: 1

We are evaluating: P[X1Xm+1Min(r,Xm+2)Xm+2Xm+3X2m+1t]

(our answer is ((2m+1)!)×
of this as t ), the full integral follows:

  • tf(x2m+1)(x2m+1f(x2m)(xm+3f(xm+2)(Min(r,xm+2)f(xm+1)(xm+1f(xm)(x2f(x1)dx1)dxm)dxm+1)dxm+2)dx2m)dx2m+1

We operate on the inner bit:

  • xm+1f(xm)(x2f(x1)dx1)dxm=1m!F(xm+1)m

We substitute this back in to yield:

  • 1m!tf(x2m+1)(x2m+1f(x2m)(xm+3f(xm+2)(Min(r,xm+2)f(xm+1)F(xm+1)mdxm+1)dxm+2)dx2m)dx2m+1

Conclusion of progression 1

We see here that

Progression: 2

This'll involve induction and dealing with the Min() will be "tricky", both for practice and induction we will consider the special cases m=1 and m=2 by evaluating:

  • m=1 yields I1:=11!tf(x3)(Min(r,x3)f(x2)F(x2)dx2)dx3
    , by case analysis:
    1. if tr then x3tr or x3r over the entire domain of interest, so Min(r,x3)=x3 over the entire domain, giving:
      • I1=11!tf(x3)(x3f(x2)F(x2)dx2)dx3
        • We now use the corollary below to see:
          • I1=12!tf(x3)F(x3)2dx3
            =13!F(t)3
    2. if tr then we split (,t] into (,r) and [r,t], giving:
      • I1=11![rf(x3)(Min(r,x3)f(x2)F(x2)dx2)dx3+trf(x3)(Min(r,x3)f(x2)F(x2)dx2)dx3]
        =11![rf(x3)(x3f(x2)F(x2)dx2)dx3+trf(x3)(rf(x2)F(x2)dx2)dx3]
        • We now use the required corollary immediately below to yield:
          I1=11![rf(x3)12F(x3)2dx3+trf(x3)12F(r)2dx3]
          =12![13F(r)3+F(r)2trf(x3)dx3]
          , note that: trf(x)dx=tf(x)dxrf(x)dx
          =F(t)F(r)
          =12!F(r)2[13F(r)+(F(t)F(r))]
          , note that: F(t)F(r)=3F(t)3F(r)3
          which we'll use next
          =12!F(r)2[3F(t)2F(r)3]
          =13!F(r)2(3F(t)2F(r))

It is clear that as t that we end up with I1=13!F(r)2(32F(r))

Thus: P[X1X2Min(r,X3)X3]=13!F(r)2(32F(r))

Finally:

  • P[X1X2r | X1X2X3]=F(r)2(32F(r))

Required corollary

Recall from Probability of i.i.d random variables being in an order and not greater than something that:

  • 1k!rf(x)F(x)kdx=1(k+1)!F(r)k+1

So:

  • rf(x)F(x)kdx=1k+1F(r)k+1

By applying this to above (with the x2 integrals):

  • rf(x)F(x)1dx=12F(r)2
    , we then substitute this for the cases r:=r and r:=x3

We'll then apply it to the x3 integrals.

Conclusion of progression 2

  • P[X1X2r | X1X2X3]=F(r)2(32F(r))

Progression: 3

I am now looking at m=3, which is 7 samples. To find this we evaluate:

  • P[Medianr]=7!3!limt+(tf(x7)(x7f(x6)(x6f(x5)(Min(r,x5)f(x4)F(x4)3dx4)dx5)dx6)dx7)

Initial work:

  1. I1(x6):=x6f(x5)(Min(r,x5)f(x4)F(x4)3dx4)dx5={1514F(x6)5if x6r1514F(r)4(5F(x6)4F(r))if x6r
    - these agree if x6=r
  2. I2(x7):=x7f(x6)(x6f(x5)(Min(r,x5)f(x4)F(x4)3dx4)dx5)dx6=x7f(x6)I1(x6)dx6
    =161514{F(x7)6if x7rF(r)4(10F(r)224F(r)F(x7)+15F(x7)2)if x7r
    - note both parts agree if r=x7 as 10+1524=1
  3. I3(t)= (everything in the limit) =tf(x7)I2(x7)dx7
    =17161514{F(t)7if trF(r)4(20F(r)3+70F(r)2F(t)84F(r)F(t)2+35F(t)3)if tr
    - note these agree if t=r
    • Clearly as t+ we get I3(t)17161514F(r)4(20F(r)3+70F(r)284F(r)+35)
      as F(t)1

From the top of this section:

  • P[Medianr]=7!3!I3(+)=F(r)4(20F(r)3+70F(r)284F(r)+35)


Conclusion:

  • P[Medianr]=F(r)4(20F(r)3+70F(r)284F(r)+35)