<< Statistics`MultiDiscreteDistributions`
<< Statistics`ContinuousDistributions`
(p = {1/6, 1/6, 1/6, 1/6, 1/6, 1/6}; 
mdist[n_] := 
        MultinomialDistribution[n, p])
refdist = ChiSquareDistribution[5]
CSStatist[
        n_Integer] := {
CV = 
          Random[mdist[n]]; 
Dif = (CV - n/6)/
            Sqrt[n/6]; 
CS = 
          N[Dif . Dif]}

    
CSdata = 
        Flatten[Table[CSStatist[24], {k, 1, 5000}]];

    
nn = 5000;
zz = Sort[CSdata];
hh = Table[k, {k, 1, nn}]*(1/nn); // 
      N
J1 = 
        Table[{zz[[i]], hh[[i]]}, {i, 1, 
            nn}];
ListPlot[J1]
Delta[x_] := 0 /; x < 0
Delta[x_] := 1 /; x ≥ 0
DE[x_] := 
      Table[{Delta[zz[[i]] - x]}, {i, 1, nn}]
EDF[nn_, x_] := 
      1.  - Apply[Plus, DE[x]]*(1/nn) // N
P11 = 
      Plot[EDF[nn, x], {x, 0, 15}, 
        PlotStyle -> {Thickness[1/100], RGBColor[0.000, 1.000, 0.196], 
            Dashing[{}]}]
LimDist[x_] := CDF[refdist, x]
P2 = 
      Plot[LimDist[x], {x, 0, 15}, 
        PlotRange -> {0, 1}]
Show[P11, P2]

    
CSdata = 
        Flatten[Table[CSStatist[36], {k, 1, 5000}]];

    
nn = 5000;
zz = Sort[CSdata];
hh = Table[k, {k, 1, nn}]*(1/nn); // 
      N
J1 = 
        Table[{zz[[i]], hh[[i]]}, {i, 1, 
            nn}];
ListPlot[J1]
Delta[x_] := 0 /; x < 0
Delta[x_] := 1 /; x ≥ 0
DE[x_] := 
      Table[{Delta[zz[[i]] - x]}, {i, 1, nn}]
EDF[nn_, x_] := 
      1.  - Apply[Plus, DE[x]]*(1/nn) // N
P11 = 
      Plot[EDF[nn, x], {x, 0, 15}, 
        PlotStyle -> {Thickness[1/100], RGBColor[0.000, 1.000, 0.196], 
            Dashing[{}]}]
LimDist[x_] := CDF[refdist, x]
P2 = 
      Plot[LimDist[x], {x, 0, 15}, 
        PlotRange -> {0, 1}]
Show[P11, P2]

    
CSdata = 
        Flatten[Table[CSStatist[48], {k, 1, 5000}]];

    
nn = 5000;
zz = Sort[CSdata];
hh = Table[k, {k, 1, nn}]*(1/nn); // 
      N
J1 = 
        Table[{zz[[i]], hh[[i]]}, {i, 1, 
            nn}];
ListPlot[J1]
Delta[x_] := 0 /; x < 0
Delta[x_] := 1 /; x ≥ 0
DE[x_] := 
      Table[{Delta[zz[[i]] - x]}, {i, 1, nn}]
EDF[nn_, x_] := 
      1.  - Apply[Plus, DE[x]]*(1/nn) // N
P11 = 
      Plot[EDF[nn, x], {x, 0, 15}, 
        PlotStyle -> {Thickness[1/100], RGBColor[0.000, 1.000, 0.196], 
            Dashing[{}]}]
LimDist[x_] := CDF[refdist, x]
P2 = 
      Plot[LimDist[x], {x, 0, 15}, 
        PlotRange -> {0, 1}]
Show[P11, P2]

    
CSdata = 
        Flatten[Table[CSStatist[60], {k, 1, 5000}]];

    
nn = 5000;
zz = Sort[CSdata];
hh = Table[k, {k, 1, nn}]*(1/nn); // 
      N
J1 = 
        Table[{zz[[i]], hh[[i]]}, {i, 1, 
            nn}];
ListPlot[J1]
Delta[x_] := 0 /; x < 0
Delta[x_] := 1 /; x ≥ 0
DE[x_] := 
      Table[{Delta[zz[[i]] - x]}, {i, 1, nn}]
EDF[nn_, x_] := 
      1.  - Apply[Plus, DE[x]]*(1/nn) // N
P11 = 
      Plot[EDF[nn, x], {x, 0, 15}, 
        PlotStyle -> {Thickness[1/100], RGBColor[0.000, 1.000, 0.196], 
            Dashing[{}]}]
LimDist[x_] := CDF[refdist, x]
P2 = 
      Plot[LimDist[x], {x, 0, 15}, 
        PlotRange -> {0, 1}]
Show[P11, P2]

    
CSdata = 
        Flatten[Table[CSStatist[90], {k, 1, 5000}]];

    
nn = 5000;
zz = Sort[CSdata];
hh = Table[k, {k, 1, nn}]*(1/nn); // 
      N
J1 = 
        Table[{zz[[i]], hh[[i]]}, {i, 1, 
            nn}];
ListPlot[J1]
Delta[x_] := 0 /; x < 0
Delta[x_] := 1 /; x ≥ 0
DE[x_] := 
      Table[{Delta[zz[[i]] - x]}, {i, 1, nn}]
EDF[nn_, x_] := 
      1.  - Apply[Plus, DE[x]]*(1/nn) // N
P11 = 
      Plot[EDF[nn, x], {x, 0, 15}, 
        PlotStyle -> {Thickness[1/100], RGBColor[0.000, 1.000, 0.196], 
            Dashing[{}]}]
LimDist[x_] := CDF[refdist, x]
P2 = 
      Plot[LimDist[x], {x, 0, 15}, 
        PlotRange -> {0, 1}]
Show[P11, P2]

    
CSdata = 
        Flatten[Table[
            CSStatist[120], {k, 1, 5000}]];

    
nn = 5000;
zz = Sort[CSdata];
hh = Table[k, {k, 1, nn}]*(1/nn); // 
      N
J1 = 
        Table[{zz[[i]], hh[[i]]}, {i, 1, 
            nn}];
ListPlot[J1]
Delta[x_] := 0 /; x < 0
Delta[x_] := 1 /; x ≥ 0
DE[x_] := 
      Table[{Delta[zz[[i]] - x]}, {i, 1, nn}]
EDF[nn_, x_] := 
      1.  - Apply[Plus, DE[x]]*(1/nn) // N
P11 = 
      Plot[EDF[nn, x], {x, 0, 15}, 
        PlotStyle -> {Thickness[1/100], RGBColor[0.000, 1.000, 0.196], 
            Dashing[{}]}]
LimDist[x_] := CDF[refdist, x]
P2 = 
      Plot[LimDist[x], {x, 0, 15}, 
        PlotRange -> {0, 1}]
Show[P11, P2]