Could this problem be tackled using Mathematica?Functions that remember some arguments while not remembering...

How does the Divination wizard's Expert Divination feature work when you upcast a divination spell?

Does a Hand Crossbow with the Repeating Shot Infusion still require a Free Hand to use?

I need help with pasta

Most important new papers in computational complexity

How do we separate rules of logic from non-logical constraints?

Prime parity peregrination

Why wasn't EBCDIC designed with contiguous alphanumeric characters?

Journal standards vs. personal standards

Divergent Series & Continued Fraction (from Gauss' Mathematical Diary)

Checkmate in 1 on a Tangled Board

Is there reliable evidence that depleted uranium from the 1999 NATO bombing is causing cancer in Serbia?

How can I tell what kind of genitals people have without gender?

Why wasn't ASCII designed with a contiguous alphanumeric character order?

Could this problem be tackled using Mathematica?

If two black hole event horizons overlap (touch) can they ever separate again?

How did researchers find articles before the Internet and the computer era?

"sort -nu" on uuids

Security Patch SUPEE-11155 - Possible issues?

The warming up game

Do the 26 richest billionaires own as much wealth as the poorest 3.8 billion people?

How did Lefschetz do mathematics without hands?

Is it okay to fade a human face just to create some space to place important content over it?

Why is Japan trying to have a better relationship with Iran?

What game is this character in the Pixels movie from?



Could this problem be tackled using Mathematica?


Functions that remember some arguments while not remembering other argumentsJudging the quality of fitting an EventData object to a distribution using LogRankTestI need a technique for determining and drawing a line where the density in a listplot jumps up suddenlyFindDistributionParameters of a sum of a mixture distributionDraw from a given list according to empirical distributionCalculate sum of probabilities in multinomial modelPearsonChiSquareTest for count/frequency data?PearsonDistribution[a1,a0,b2,b1,b0]: What are the formulas for a1 and a0?How to conveniently plot 3-category Dirichlet data in equilateral triangle instead of 2-simplexScaling and shifting in fitting of a LogNormal distribution from experimental dataCreating a probability distribution using Piecewise






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







6












$begingroup$


I posted this question on Math, but there has been silence there since. So, I wonder if anyone here can get any closer to the answer to my question using Mathematica. Here is the question:



Suppose I draw $N$ random variables from independent but identical uniform distributions, where $N$ is an even integer. I now sort the drawn values and find the two middlemost of these. Finally, I calculate a simple average of these two middlemost values.



Is there a closed-form description of the progression of distributions that arise as $N$ increases from $N=2$ to $N=∞$ ? The first distribution is easily found to be Triangular, but what about the rest? Plots from simulations in MATLAB, with a uniform distribution on the range 0 to 1, provide the following illustrations:



enter image description here










share|improve this question









$endgroup$



















    6












    $begingroup$


    I posted this question on Math, but there has been silence there since. So, I wonder if anyone here can get any closer to the answer to my question using Mathematica. Here is the question:



    Suppose I draw $N$ random variables from independent but identical uniform distributions, where $N$ is an even integer. I now sort the drawn values and find the two middlemost of these. Finally, I calculate a simple average of these two middlemost values.



    Is there a closed-form description of the progression of distributions that arise as $N$ increases from $N=2$ to $N=∞$ ? The first distribution is easily found to be Triangular, but what about the rest? Plots from simulations in MATLAB, with a uniform distribution on the range 0 to 1, provide the following illustrations:



    enter image description here










    share|improve this question









    $endgroup$















      6












      6








      6


      1



      $begingroup$


      I posted this question on Math, but there has been silence there since. So, I wonder if anyone here can get any closer to the answer to my question using Mathematica. Here is the question:



      Suppose I draw $N$ random variables from independent but identical uniform distributions, where $N$ is an even integer. I now sort the drawn values and find the two middlemost of these. Finally, I calculate a simple average of these two middlemost values.



      Is there a closed-form description of the progression of distributions that arise as $N$ increases from $N=2$ to $N=∞$ ? The first distribution is easily found to be Triangular, but what about the rest? Plots from simulations in MATLAB, with a uniform distribution on the range 0 to 1, provide the following illustrations:



      enter image description here










      share|improve this question









      $endgroup$




      I posted this question on Math, but there has been silence there since. So, I wonder if anyone here can get any closer to the answer to my question using Mathematica. Here is the question:



      Suppose I draw $N$ random variables from independent but identical uniform distributions, where $N$ is an even integer. I now sort the drawn values and find the two middlemost of these. Finally, I calculate a simple average of these two middlemost values.



      Is there a closed-form description of the progression of distributions that arise as $N$ increases from $N=2$ to $N=∞$ ? The first distribution is easily found to be Triangular, but what about the rest? Plots from simulations in MATLAB, with a uniform distribution on the range 0 to 1, provide the following illustrations:



      enter image description here







      probability-or-statistics






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 9 hours ago









      user120911user120911

      9663 silver badges9 bronze badges




      9663 silver badges9 bronze badges






















          3 Answers
          3






          active

          oldest

          votes


















          9












          $begingroup$

          A partial answer: here is a way to calculate these distributions exactly for any $n$ (given enough patience). Memoizing them with this trick.



          f[n_Integer?Positive] := f[n] = Module[{v},
          (* make a list of n unique variables *)
          v = Table[Unique[], n];
          (* calculate the n-fold integral and return the distribution as a function *)
          Function[a, Evaluate@Assuming[0 < a < 1,
          Integrate[DiracDelta[Mean[v] - a],
          Sequence @@ ({#, 0, 1} & /@ v)] // FullSimplify]]]


          update



          You can calculate these much more easily with



          f[n_Integer?Positive] := PDF[UniformSumDistribution[n, {0,1/n}]]


          Test:



          f[1][a]
          (* 1 *)

          f[2][a]
          (* 2 (1 + (-1 + 2 a) HeavisideTheta[1 - 2 a] + (1 - 2 a) HeavisideTheta[-1 + 2 a]) *)


          It looks like for given order $n$ the distribution is a combination of $n$ polynomials of order $n-1$, each taking up a fraction $1/n$ of the interval $[0,1]$. For example, for $n=3$ the distribution is composed of three parabolas (second-order polynomials), each spanning $1/3$ of the unit interval:



          Assuming[0 < a < 1/3, f[3][a] // FullSimplify]
          (* (27 a^2)/2 *)
          Assuming[1/3 < a < 2/3, f[3][a] // FullSimplify]
          (* -(9/2) (1 + 6 (-1 + a) a) *)
          Assuming[2/3 < a < 1, f[3][a] // FullSimplify]
          (* 27/2 (-1 + a)^2 *)

          Plot[Evaluate@Table[f[n][a], {n, 4}], {a, 0, 1}, PlotLegends -> Range[4]]


          enter image description here



          For $ntoinfty$ the distribution becomes Gaussian with mean $langle arangle=frac12$ and variance $langle a^2rangle-langle arangle^2=frac{1}{12n}$:



          $$
          p_{ngg1}(a) approx sqrt{frac{6n}{pi}} e^{-6n(a - 1/2)^2}
          $$



          Comparison for $n=4$:



          With[{n = 4},
          Plot[{f[n][a], Sqrt[6n/π]*E^(-6n(a-1/2)^2)}, {a, 0, 1},
          PlotLegends -> {"exact", "Gaussian"}]]


          enter image description here






          share|improve this answer











          $endgroup$













          • $begingroup$
            Interesting. I had thought the distribution tended to collapse on 0.5, becoming a line.
            $endgroup$
            – user120911
            9 hours ago






          • 1




            $begingroup$
            @user120911 see edit: the variance goes down as $1/(12n)$. For finite (but large) $n$ it's a Gaussian with finite width.
            $endgroup$
            – Roman
            9 hours ago



















          5












          $begingroup$

          Mathematica does make this pretty easy. The statistic of interest is the typical estimator of the median when the sample size is even. When the sample size is odd the sample median has a beta distribution:



          OrderDistribution[{UniformDistribution[{0, 1}], n}, (n + 1)/2]
          (* BetaDistribution[(1 + n)/2, 1 + 1/2 (-1 - n) + n] *)


          Now for the case when $n$ is even. First find the joint distribution of the middle two order statistics. Then find the distribution of the mean of those two statistics.



          n = 6;
          od = OrderDistribution[{UniformDistribution[{0, 1}], n}, {n/2, n/2 + 1}];

          md = TransformedDistribution[(x1 + x2)/2, {x1, x2} [Distributed] od];

          PDF[md, x]


          PDF of distribution



          Plot[Evaluate[PDF[md, x]], {x, 0, 1}]


          Density function



          To obtain the distribution for general $n$ when $n$ is odd we have to use some other than TransformedDistribution. We need to integrate the joint density function and treat $0<x<1/2$, $x=1/2$, and $1/2<x<1$ separately.



          fltOneHalf = 2 Integrate[(x1^(-1 + n/2) (1 - x2)^(-1 + n/2) n!)/((-1 + n/2)!)^2 /. 
          x2 -> 2 x - x1, {x1, 0, x}, Assumptions -> n > 1 && 0 < x < 1/2]
          (* -((4 ((1 - 2 x) x)^(n/2) Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, x/(-1 + 2 x)])/((-1 + 2 x)*
          Gamma[n/2]^2)) *)

          fOneHalf = 2 Integrate[(x1^(-1 + n/2) (1 - x2)^(-1 + n/2) n!)/((-1 + n/2)!)^2 /.
          x2 -> 1 - x1, {x1, 0, 1/2}, Assumptions -> n > 1]
          (* (2^(2 - n) n!)/((-1 + n) ((-1 + n/2)!)^2) *)

          (* Because the density is symmetric, we'll take advantage of that *)
          fgtOneHalf = FullSimplify[fltOneHalf /. x -> y /. y -> 1 - x]
          (* (4 (-1 + (3 - 2 x) x)^(n/2) Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, (-1 + x)/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2) *)


          Putting this together in a single function:



          pdf[n_, x_] := 
          Piecewise[{{-((4 ((1 - 2 x) x)^(n/2)*Gamma[n] Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2,
          x/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2)), 0 < x < 1/2},
          {(2^(2 - n) n!)/((-1 + n) ((-1 + n/2)!)^2), x == 1/2},
          {(4 (-1 + (3 - 2 x) x)^(n/2) * Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, (-1 + x)/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2),
          1/2 < x < 1}}, 0]





          share|improve this answer











          $endgroup$













          • $begingroup$
            Wow that is pretty slick. One interesting thing is that Mathematica only seems to like to compute the ones with even n, perhaps because OrderDistribution doesn't like fractional values or perhaps because those are the only ones where the polynomials work out.
            $endgroup$
            – b3m2a1
            2 hours ago










          • $begingroup$
            @b3m2a1 I'm in the process of adding in the code for odd n and the formulas for general n. Should be able to get to that in about an hour.
            $endgroup$
            – JimB
            1 hour ago










          • $begingroup$
            I'm interested in what the general form looks like... I took a bit of time to try to find a pattern for these even n but still no dice.
            $endgroup$
            – b3m2a1
            1 hour ago



















          1












          $begingroup$

          Here's an interesting counter-example for a discrete uniform distribution does not tend to your shape as $N$ grows.



          Let your r.v. $x$ be distributed as per a coin toss, taking value ${0,1}$ with equal probability. Then you have three possible outcomes after $N$ coin tosses; $0, 1/2$ , or $1$



          The middle outcome's probability is the probability that with $N$ coin tosses you get exactly $N/2$ zeros or ones. This probability is



          $$
          2^{-n} binom{n}{frac{n}{2}}
          $$



          Which decreases in $N$, resulting in the plot below, with the distribution of probabilities of values with $N$



          enter image description here



          EDIT



          You can see the same effect with the discrete distribution for $x$ expanded to take values $x={1, 2, ... , 50}$ with equal probability. The non-integer values are much less likely, since the odds of the two middle points hitting the boundary is low. The integers values do tend to a Guassian.



          middleMean[n_, range_] := Module[{res}, 
          res = Sort@Table[RandomChoice[Range[range]], {n}];
          Mean[{res[[n/2]], res[[n/2 + 1]]}]
          ]

          Histogram[Table[middleMean[500, 50], {1000}], 50]


          enter image description here






          share|improve this answer











          $endgroup$













          • $begingroup$
            If you plot all possible mean outcomes instead of only 0, 1/2, and 1, then you see that the central limit theorem still applies and you still get a Gaussian as $ntoinfty$.
            $endgroup$
            – Roman
            8 hours ago










          • $begingroup$
            For my discrete uniform, the $x$ can only take 0 or 1, which means the average of the two middle points can only take values 0, 1/2, or 1. So no way to get a distribution over anything else. It is a bit contrived, but interesting.
            $endgroup$
            – MikeY
            3 hours ago














          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "387"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f201060%2fcould-this-problem-be-tackled-using-mathematica%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          9












          $begingroup$

          A partial answer: here is a way to calculate these distributions exactly for any $n$ (given enough patience). Memoizing them with this trick.



          f[n_Integer?Positive] := f[n] = Module[{v},
          (* make a list of n unique variables *)
          v = Table[Unique[], n];
          (* calculate the n-fold integral and return the distribution as a function *)
          Function[a, Evaluate@Assuming[0 < a < 1,
          Integrate[DiracDelta[Mean[v] - a],
          Sequence @@ ({#, 0, 1} & /@ v)] // FullSimplify]]]


          update



          You can calculate these much more easily with



          f[n_Integer?Positive] := PDF[UniformSumDistribution[n, {0,1/n}]]


          Test:



          f[1][a]
          (* 1 *)

          f[2][a]
          (* 2 (1 + (-1 + 2 a) HeavisideTheta[1 - 2 a] + (1 - 2 a) HeavisideTheta[-1 + 2 a]) *)


          It looks like for given order $n$ the distribution is a combination of $n$ polynomials of order $n-1$, each taking up a fraction $1/n$ of the interval $[0,1]$. For example, for $n=3$ the distribution is composed of three parabolas (second-order polynomials), each spanning $1/3$ of the unit interval:



          Assuming[0 < a < 1/3, f[3][a] // FullSimplify]
          (* (27 a^2)/2 *)
          Assuming[1/3 < a < 2/3, f[3][a] // FullSimplify]
          (* -(9/2) (1 + 6 (-1 + a) a) *)
          Assuming[2/3 < a < 1, f[3][a] // FullSimplify]
          (* 27/2 (-1 + a)^2 *)

          Plot[Evaluate@Table[f[n][a], {n, 4}], {a, 0, 1}, PlotLegends -> Range[4]]


          enter image description here



          For $ntoinfty$ the distribution becomes Gaussian with mean $langle arangle=frac12$ and variance $langle a^2rangle-langle arangle^2=frac{1}{12n}$:



          $$
          p_{ngg1}(a) approx sqrt{frac{6n}{pi}} e^{-6n(a - 1/2)^2}
          $$



          Comparison for $n=4$:



          With[{n = 4},
          Plot[{f[n][a], Sqrt[6n/π]*E^(-6n(a-1/2)^2)}, {a, 0, 1},
          PlotLegends -> {"exact", "Gaussian"}]]


          enter image description here






          share|improve this answer











          $endgroup$













          • $begingroup$
            Interesting. I had thought the distribution tended to collapse on 0.5, becoming a line.
            $endgroup$
            – user120911
            9 hours ago






          • 1




            $begingroup$
            @user120911 see edit: the variance goes down as $1/(12n)$. For finite (but large) $n$ it's a Gaussian with finite width.
            $endgroup$
            – Roman
            9 hours ago
















          9












          $begingroup$

          A partial answer: here is a way to calculate these distributions exactly for any $n$ (given enough patience). Memoizing them with this trick.



          f[n_Integer?Positive] := f[n] = Module[{v},
          (* make a list of n unique variables *)
          v = Table[Unique[], n];
          (* calculate the n-fold integral and return the distribution as a function *)
          Function[a, Evaluate@Assuming[0 < a < 1,
          Integrate[DiracDelta[Mean[v] - a],
          Sequence @@ ({#, 0, 1} & /@ v)] // FullSimplify]]]


          update



          You can calculate these much more easily with



          f[n_Integer?Positive] := PDF[UniformSumDistribution[n, {0,1/n}]]


          Test:



          f[1][a]
          (* 1 *)

          f[2][a]
          (* 2 (1 + (-1 + 2 a) HeavisideTheta[1 - 2 a] + (1 - 2 a) HeavisideTheta[-1 + 2 a]) *)


          It looks like for given order $n$ the distribution is a combination of $n$ polynomials of order $n-1$, each taking up a fraction $1/n$ of the interval $[0,1]$. For example, for $n=3$ the distribution is composed of three parabolas (second-order polynomials), each spanning $1/3$ of the unit interval:



          Assuming[0 < a < 1/3, f[3][a] // FullSimplify]
          (* (27 a^2)/2 *)
          Assuming[1/3 < a < 2/3, f[3][a] // FullSimplify]
          (* -(9/2) (1 + 6 (-1 + a) a) *)
          Assuming[2/3 < a < 1, f[3][a] // FullSimplify]
          (* 27/2 (-1 + a)^2 *)

          Plot[Evaluate@Table[f[n][a], {n, 4}], {a, 0, 1}, PlotLegends -> Range[4]]


          enter image description here



          For $ntoinfty$ the distribution becomes Gaussian with mean $langle arangle=frac12$ and variance $langle a^2rangle-langle arangle^2=frac{1}{12n}$:



          $$
          p_{ngg1}(a) approx sqrt{frac{6n}{pi}} e^{-6n(a - 1/2)^2}
          $$



          Comparison for $n=4$:



          With[{n = 4},
          Plot[{f[n][a], Sqrt[6n/π]*E^(-6n(a-1/2)^2)}, {a, 0, 1},
          PlotLegends -> {"exact", "Gaussian"}]]


          enter image description here






          share|improve this answer











          $endgroup$













          • $begingroup$
            Interesting. I had thought the distribution tended to collapse on 0.5, becoming a line.
            $endgroup$
            – user120911
            9 hours ago






          • 1




            $begingroup$
            @user120911 see edit: the variance goes down as $1/(12n)$. For finite (but large) $n$ it's a Gaussian with finite width.
            $endgroup$
            – Roman
            9 hours ago














          9












          9








          9





          $begingroup$

          A partial answer: here is a way to calculate these distributions exactly for any $n$ (given enough patience). Memoizing them with this trick.



          f[n_Integer?Positive] := f[n] = Module[{v},
          (* make a list of n unique variables *)
          v = Table[Unique[], n];
          (* calculate the n-fold integral and return the distribution as a function *)
          Function[a, Evaluate@Assuming[0 < a < 1,
          Integrate[DiracDelta[Mean[v] - a],
          Sequence @@ ({#, 0, 1} & /@ v)] // FullSimplify]]]


          update



          You can calculate these much more easily with



          f[n_Integer?Positive] := PDF[UniformSumDistribution[n, {0,1/n}]]


          Test:



          f[1][a]
          (* 1 *)

          f[2][a]
          (* 2 (1 + (-1 + 2 a) HeavisideTheta[1 - 2 a] + (1 - 2 a) HeavisideTheta[-1 + 2 a]) *)


          It looks like for given order $n$ the distribution is a combination of $n$ polynomials of order $n-1$, each taking up a fraction $1/n$ of the interval $[0,1]$. For example, for $n=3$ the distribution is composed of three parabolas (second-order polynomials), each spanning $1/3$ of the unit interval:



          Assuming[0 < a < 1/3, f[3][a] // FullSimplify]
          (* (27 a^2)/2 *)
          Assuming[1/3 < a < 2/3, f[3][a] // FullSimplify]
          (* -(9/2) (1 + 6 (-1 + a) a) *)
          Assuming[2/3 < a < 1, f[3][a] // FullSimplify]
          (* 27/2 (-1 + a)^2 *)

          Plot[Evaluate@Table[f[n][a], {n, 4}], {a, 0, 1}, PlotLegends -> Range[4]]


          enter image description here



          For $ntoinfty$ the distribution becomes Gaussian with mean $langle arangle=frac12$ and variance $langle a^2rangle-langle arangle^2=frac{1}{12n}$:



          $$
          p_{ngg1}(a) approx sqrt{frac{6n}{pi}} e^{-6n(a - 1/2)^2}
          $$



          Comparison for $n=4$:



          With[{n = 4},
          Plot[{f[n][a], Sqrt[6n/π]*E^(-6n(a-1/2)^2)}, {a, 0, 1},
          PlotLegends -> {"exact", "Gaussian"}]]


          enter image description here






          share|improve this answer











          $endgroup$



          A partial answer: here is a way to calculate these distributions exactly for any $n$ (given enough patience). Memoizing them with this trick.



          f[n_Integer?Positive] := f[n] = Module[{v},
          (* make a list of n unique variables *)
          v = Table[Unique[], n];
          (* calculate the n-fold integral and return the distribution as a function *)
          Function[a, Evaluate@Assuming[0 < a < 1,
          Integrate[DiracDelta[Mean[v] - a],
          Sequence @@ ({#, 0, 1} & /@ v)] // FullSimplify]]]


          update



          You can calculate these much more easily with



          f[n_Integer?Positive] := PDF[UniformSumDistribution[n, {0,1/n}]]


          Test:



          f[1][a]
          (* 1 *)

          f[2][a]
          (* 2 (1 + (-1 + 2 a) HeavisideTheta[1 - 2 a] + (1 - 2 a) HeavisideTheta[-1 + 2 a]) *)


          It looks like for given order $n$ the distribution is a combination of $n$ polynomials of order $n-1$, each taking up a fraction $1/n$ of the interval $[0,1]$. For example, for $n=3$ the distribution is composed of three parabolas (second-order polynomials), each spanning $1/3$ of the unit interval:



          Assuming[0 < a < 1/3, f[3][a] // FullSimplify]
          (* (27 a^2)/2 *)
          Assuming[1/3 < a < 2/3, f[3][a] // FullSimplify]
          (* -(9/2) (1 + 6 (-1 + a) a) *)
          Assuming[2/3 < a < 1, f[3][a] // FullSimplify]
          (* 27/2 (-1 + a)^2 *)

          Plot[Evaluate@Table[f[n][a], {n, 4}], {a, 0, 1}, PlotLegends -> Range[4]]


          enter image description here



          For $ntoinfty$ the distribution becomes Gaussian with mean $langle arangle=frac12$ and variance $langle a^2rangle-langle arangle^2=frac{1}{12n}$:



          $$
          p_{ngg1}(a) approx sqrt{frac{6n}{pi}} e^{-6n(a - 1/2)^2}
          $$



          Comparison for $n=4$:



          With[{n = 4},
          Plot[{f[n][a], Sqrt[6n/π]*E^(-6n(a-1/2)^2)}, {a, 0, 1},
          PlotLegends -> {"exact", "Gaussian"}]]


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 6 mins ago

























          answered 9 hours ago









          RomanRoman

          11.9k1 gold badge19 silver badges45 bronze badges




          11.9k1 gold badge19 silver badges45 bronze badges












          • $begingroup$
            Interesting. I had thought the distribution tended to collapse on 0.5, becoming a line.
            $endgroup$
            – user120911
            9 hours ago






          • 1




            $begingroup$
            @user120911 see edit: the variance goes down as $1/(12n)$. For finite (but large) $n$ it's a Gaussian with finite width.
            $endgroup$
            – Roman
            9 hours ago


















          • $begingroup$
            Interesting. I had thought the distribution tended to collapse on 0.5, becoming a line.
            $endgroup$
            – user120911
            9 hours ago






          • 1




            $begingroup$
            @user120911 see edit: the variance goes down as $1/(12n)$. For finite (but large) $n$ it's a Gaussian with finite width.
            $endgroup$
            – Roman
            9 hours ago
















          $begingroup$
          Interesting. I had thought the distribution tended to collapse on 0.5, becoming a line.
          $endgroup$
          – user120911
          9 hours ago




          $begingroup$
          Interesting. I had thought the distribution tended to collapse on 0.5, becoming a line.
          $endgroup$
          – user120911
          9 hours ago




          1




          1




          $begingroup$
          @user120911 see edit: the variance goes down as $1/(12n)$. For finite (but large) $n$ it's a Gaussian with finite width.
          $endgroup$
          – Roman
          9 hours ago




          $begingroup$
          @user120911 see edit: the variance goes down as $1/(12n)$. For finite (but large) $n$ it's a Gaussian with finite width.
          $endgroup$
          – Roman
          9 hours ago













          5












          $begingroup$

          Mathematica does make this pretty easy. The statistic of interest is the typical estimator of the median when the sample size is even. When the sample size is odd the sample median has a beta distribution:



          OrderDistribution[{UniformDistribution[{0, 1}], n}, (n + 1)/2]
          (* BetaDistribution[(1 + n)/2, 1 + 1/2 (-1 - n) + n] *)


          Now for the case when $n$ is even. First find the joint distribution of the middle two order statistics. Then find the distribution of the mean of those two statistics.



          n = 6;
          od = OrderDistribution[{UniformDistribution[{0, 1}], n}, {n/2, n/2 + 1}];

          md = TransformedDistribution[(x1 + x2)/2, {x1, x2} [Distributed] od];

          PDF[md, x]


          PDF of distribution



          Plot[Evaluate[PDF[md, x]], {x, 0, 1}]


          Density function



          To obtain the distribution for general $n$ when $n$ is odd we have to use some other than TransformedDistribution. We need to integrate the joint density function and treat $0<x<1/2$, $x=1/2$, and $1/2<x<1$ separately.



          fltOneHalf = 2 Integrate[(x1^(-1 + n/2) (1 - x2)^(-1 + n/2) n!)/((-1 + n/2)!)^2 /. 
          x2 -> 2 x - x1, {x1, 0, x}, Assumptions -> n > 1 && 0 < x < 1/2]
          (* -((4 ((1 - 2 x) x)^(n/2) Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, x/(-1 + 2 x)])/((-1 + 2 x)*
          Gamma[n/2]^2)) *)

          fOneHalf = 2 Integrate[(x1^(-1 + n/2) (1 - x2)^(-1 + n/2) n!)/((-1 + n/2)!)^2 /.
          x2 -> 1 - x1, {x1, 0, 1/2}, Assumptions -> n > 1]
          (* (2^(2 - n) n!)/((-1 + n) ((-1 + n/2)!)^2) *)

          (* Because the density is symmetric, we'll take advantage of that *)
          fgtOneHalf = FullSimplify[fltOneHalf /. x -> y /. y -> 1 - x]
          (* (4 (-1 + (3 - 2 x) x)^(n/2) Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, (-1 + x)/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2) *)


          Putting this together in a single function:



          pdf[n_, x_] := 
          Piecewise[{{-((4 ((1 - 2 x) x)^(n/2)*Gamma[n] Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2,
          x/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2)), 0 < x < 1/2},
          {(2^(2 - n) n!)/((-1 + n) ((-1 + n/2)!)^2), x == 1/2},
          {(4 (-1 + (3 - 2 x) x)^(n/2) * Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, (-1 + x)/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2),
          1/2 < x < 1}}, 0]





          share|improve this answer











          $endgroup$













          • $begingroup$
            Wow that is pretty slick. One interesting thing is that Mathematica only seems to like to compute the ones with even n, perhaps because OrderDistribution doesn't like fractional values or perhaps because those are the only ones where the polynomials work out.
            $endgroup$
            – b3m2a1
            2 hours ago










          • $begingroup$
            @b3m2a1 I'm in the process of adding in the code for odd n and the formulas for general n. Should be able to get to that in about an hour.
            $endgroup$
            – JimB
            1 hour ago










          • $begingroup$
            I'm interested in what the general form looks like... I took a bit of time to try to find a pattern for these even n but still no dice.
            $endgroup$
            – b3m2a1
            1 hour ago
















          5












          $begingroup$

          Mathematica does make this pretty easy. The statistic of interest is the typical estimator of the median when the sample size is even. When the sample size is odd the sample median has a beta distribution:



          OrderDistribution[{UniformDistribution[{0, 1}], n}, (n + 1)/2]
          (* BetaDistribution[(1 + n)/2, 1 + 1/2 (-1 - n) + n] *)


          Now for the case when $n$ is even. First find the joint distribution of the middle two order statistics. Then find the distribution of the mean of those two statistics.



          n = 6;
          od = OrderDistribution[{UniformDistribution[{0, 1}], n}, {n/2, n/2 + 1}];

          md = TransformedDistribution[(x1 + x2)/2, {x1, x2} [Distributed] od];

          PDF[md, x]


          PDF of distribution



          Plot[Evaluate[PDF[md, x]], {x, 0, 1}]


          Density function



          To obtain the distribution for general $n$ when $n$ is odd we have to use some other than TransformedDistribution. We need to integrate the joint density function and treat $0<x<1/2$, $x=1/2$, and $1/2<x<1$ separately.



          fltOneHalf = 2 Integrate[(x1^(-1 + n/2) (1 - x2)^(-1 + n/2) n!)/((-1 + n/2)!)^2 /. 
          x2 -> 2 x - x1, {x1, 0, x}, Assumptions -> n > 1 && 0 < x < 1/2]
          (* -((4 ((1 - 2 x) x)^(n/2) Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, x/(-1 + 2 x)])/((-1 + 2 x)*
          Gamma[n/2]^2)) *)

          fOneHalf = 2 Integrate[(x1^(-1 + n/2) (1 - x2)^(-1 + n/2) n!)/((-1 + n/2)!)^2 /.
          x2 -> 1 - x1, {x1, 0, 1/2}, Assumptions -> n > 1]
          (* (2^(2 - n) n!)/((-1 + n) ((-1 + n/2)!)^2) *)

          (* Because the density is symmetric, we'll take advantage of that *)
          fgtOneHalf = FullSimplify[fltOneHalf /. x -> y /. y -> 1 - x]
          (* (4 (-1 + (3 - 2 x) x)^(n/2) Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, (-1 + x)/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2) *)


          Putting this together in a single function:



          pdf[n_, x_] := 
          Piecewise[{{-((4 ((1 - 2 x) x)^(n/2)*Gamma[n] Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2,
          x/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2)), 0 < x < 1/2},
          {(2^(2 - n) n!)/((-1 + n) ((-1 + n/2)!)^2), x == 1/2},
          {(4 (-1 + (3 - 2 x) x)^(n/2) * Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, (-1 + x)/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2),
          1/2 < x < 1}}, 0]





          share|improve this answer











          $endgroup$













          • $begingroup$
            Wow that is pretty slick. One interesting thing is that Mathematica only seems to like to compute the ones with even n, perhaps because OrderDistribution doesn't like fractional values or perhaps because those are the only ones where the polynomials work out.
            $endgroup$
            – b3m2a1
            2 hours ago










          • $begingroup$
            @b3m2a1 I'm in the process of adding in the code for odd n and the formulas for general n. Should be able to get to that in about an hour.
            $endgroup$
            – JimB
            1 hour ago










          • $begingroup$
            I'm interested in what the general form looks like... I took a bit of time to try to find a pattern for these even n but still no dice.
            $endgroup$
            – b3m2a1
            1 hour ago














          5












          5








          5





          $begingroup$

          Mathematica does make this pretty easy. The statistic of interest is the typical estimator of the median when the sample size is even. When the sample size is odd the sample median has a beta distribution:



          OrderDistribution[{UniformDistribution[{0, 1}], n}, (n + 1)/2]
          (* BetaDistribution[(1 + n)/2, 1 + 1/2 (-1 - n) + n] *)


          Now for the case when $n$ is even. First find the joint distribution of the middle two order statistics. Then find the distribution of the mean of those two statistics.



          n = 6;
          od = OrderDistribution[{UniformDistribution[{0, 1}], n}, {n/2, n/2 + 1}];

          md = TransformedDistribution[(x1 + x2)/2, {x1, x2} [Distributed] od];

          PDF[md, x]


          PDF of distribution



          Plot[Evaluate[PDF[md, x]], {x, 0, 1}]


          Density function



          To obtain the distribution for general $n$ when $n$ is odd we have to use some other than TransformedDistribution. We need to integrate the joint density function and treat $0<x<1/2$, $x=1/2$, and $1/2<x<1$ separately.



          fltOneHalf = 2 Integrate[(x1^(-1 + n/2) (1 - x2)^(-1 + n/2) n!)/((-1 + n/2)!)^2 /. 
          x2 -> 2 x - x1, {x1, 0, x}, Assumptions -> n > 1 && 0 < x < 1/2]
          (* -((4 ((1 - 2 x) x)^(n/2) Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, x/(-1 + 2 x)])/((-1 + 2 x)*
          Gamma[n/2]^2)) *)

          fOneHalf = 2 Integrate[(x1^(-1 + n/2) (1 - x2)^(-1 + n/2) n!)/((-1 + n/2)!)^2 /.
          x2 -> 1 - x1, {x1, 0, 1/2}, Assumptions -> n > 1]
          (* (2^(2 - n) n!)/((-1 + n) ((-1 + n/2)!)^2) *)

          (* Because the density is symmetric, we'll take advantage of that *)
          fgtOneHalf = FullSimplify[fltOneHalf /. x -> y /. y -> 1 - x]
          (* (4 (-1 + (3 - 2 x) x)^(n/2) Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, (-1 + x)/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2) *)


          Putting this together in a single function:



          pdf[n_, x_] := 
          Piecewise[{{-((4 ((1 - 2 x) x)^(n/2)*Gamma[n] Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2,
          x/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2)), 0 < x < 1/2},
          {(2^(2 - n) n!)/((-1 + n) ((-1 + n/2)!)^2), x == 1/2},
          {(4 (-1 + (3 - 2 x) x)^(n/2) * Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, (-1 + x)/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2),
          1/2 < x < 1}}, 0]





          share|improve this answer











          $endgroup$



          Mathematica does make this pretty easy. The statistic of interest is the typical estimator of the median when the sample size is even. When the sample size is odd the sample median has a beta distribution:



          OrderDistribution[{UniformDistribution[{0, 1}], n}, (n + 1)/2]
          (* BetaDistribution[(1 + n)/2, 1 + 1/2 (-1 - n) + n] *)


          Now for the case when $n$ is even. First find the joint distribution of the middle two order statistics. Then find the distribution of the mean of those two statistics.



          n = 6;
          od = OrderDistribution[{UniformDistribution[{0, 1}], n}, {n/2, n/2 + 1}];

          md = TransformedDistribution[(x1 + x2)/2, {x1, x2} [Distributed] od];

          PDF[md, x]


          PDF of distribution



          Plot[Evaluate[PDF[md, x]], {x, 0, 1}]


          Density function



          To obtain the distribution for general $n$ when $n$ is odd we have to use some other than TransformedDistribution. We need to integrate the joint density function and treat $0<x<1/2$, $x=1/2$, and $1/2<x<1$ separately.



          fltOneHalf = 2 Integrate[(x1^(-1 + n/2) (1 - x2)^(-1 + n/2) n!)/((-1 + n/2)!)^2 /. 
          x2 -> 2 x - x1, {x1, 0, x}, Assumptions -> n > 1 && 0 < x < 1/2]
          (* -((4 ((1 - 2 x) x)^(n/2) Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, x/(-1 + 2 x)])/((-1 + 2 x)*
          Gamma[n/2]^2)) *)

          fOneHalf = 2 Integrate[(x1^(-1 + n/2) (1 - x2)^(-1 + n/2) n!)/((-1 + n/2)!)^2 /.
          x2 -> 1 - x1, {x1, 0, 1/2}, Assumptions -> n > 1]
          (* (2^(2 - n) n!)/((-1 + n) ((-1 + n/2)!)^2) *)

          (* Because the density is symmetric, we'll take advantage of that *)
          fgtOneHalf = FullSimplify[fltOneHalf /. x -> y /. y -> 1 - x]
          (* (4 (-1 + (3 - 2 x) x)^(n/2) Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, (-1 + x)/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2) *)


          Putting this together in a single function:



          pdf[n_, x_] := 
          Piecewise[{{-((4 ((1 - 2 x) x)^(n/2)*Gamma[n] Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2,
          x/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2)), 0 < x < 1/2},
          {(2^(2 - n) n!)/((-1 + n) ((-1 + n/2)!)^2), x == 1/2},
          {(4 (-1 + (3 - 2 x) x)^(n/2) * Gamma[n]*
          Hypergeometric2F1[1 - n/2, n/2, (2 + n)/2, (-1 + x)/(-1 + 2 x)])/((-1 + 2 x) Gamma[n/2]^2),
          1/2 < x < 1}}, 0]






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 3 mins ago

























          answered 8 hours ago









          JimBJimB

          19.4k1 gold badge28 silver badges64 bronze badges




          19.4k1 gold badge28 silver badges64 bronze badges












          • $begingroup$
            Wow that is pretty slick. One interesting thing is that Mathematica only seems to like to compute the ones with even n, perhaps because OrderDistribution doesn't like fractional values or perhaps because those are the only ones where the polynomials work out.
            $endgroup$
            – b3m2a1
            2 hours ago










          • $begingroup$
            @b3m2a1 I'm in the process of adding in the code for odd n and the formulas for general n. Should be able to get to that in about an hour.
            $endgroup$
            – JimB
            1 hour ago










          • $begingroup$
            I'm interested in what the general form looks like... I took a bit of time to try to find a pattern for these even n but still no dice.
            $endgroup$
            – b3m2a1
            1 hour ago


















          • $begingroup$
            Wow that is pretty slick. One interesting thing is that Mathematica only seems to like to compute the ones with even n, perhaps because OrderDistribution doesn't like fractional values or perhaps because those are the only ones where the polynomials work out.
            $endgroup$
            – b3m2a1
            2 hours ago










          • $begingroup$
            @b3m2a1 I'm in the process of adding in the code for odd n and the formulas for general n. Should be able to get to that in about an hour.
            $endgroup$
            – JimB
            1 hour ago










          • $begingroup$
            I'm interested in what the general form looks like... I took a bit of time to try to find a pattern for these even n but still no dice.
            $endgroup$
            – b3m2a1
            1 hour ago
















          $begingroup$
          Wow that is pretty slick. One interesting thing is that Mathematica only seems to like to compute the ones with even n, perhaps because OrderDistribution doesn't like fractional values or perhaps because those are the only ones where the polynomials work out.
          $endgroup$
          – b3m2a1
          2 hours ago




          $begingroup$
          Wow that is pretty slick. One interesting thing is that Mathematica only seems to like to compute the ones with even n, perhaps because OrderDistribution doesn't like fractional values or perhaps because those are the only ones where the polynomials work out.
          $endgroup$
          – b3m2a1
          2 hours ago












          $begingroup$
          @b3m2a1 I'm in the process of adding in the code for odd n and the formulas for general n. Should be able to get to that in about an hour.
          $endgroup$
          – JimB
          1 hour ago




          $begingroup$
          @b3m2a1 I'm in the process of adding in the code for odd n and the formulas for general n. Should be able to get to that in about an hour.
          $endgroup$
          – JimB
          1 hour ago












          $begingroup$
          I'm interested in what the general form looks like... I took a bit of time to try to find a pattern for these even n but still no dice.
          $endgroup$
          – b3m2a1
          1 hour ago




          $begingroup$
          I'm interested in what the general form looks like... I took a bit of time to try to find a pattern for these even n but still no dice.
          $endgroup$
          – b3m2a1
          1 hour ago











          1












          $begingroup$

          Here's an interesting counter-example for a discrete uniform distribution does not tend to your shape as $N$ grows.



          Let your r.v. $x$ be distributed as per a coin toss, taking value ${0,1}$ with equal probability. Then you have three possible outcomes after $N$ coin tosses; $0, 1/2$ , or $1$



          The middle outcome's probability is the probability that with $N$ coin tosses you get exactly $N/2$ zeros or ones. This probability is



          $$
          2^{-n} binom{n}{frac{n}{2}}
          $$



          Which decreases in $N$, resulting in the plot below, with the distribution of probabilities of values with $N$



          enter image description here



          EDIT



          You can see the same effect with the discrete distribution for $x$ expanded to take values $x={1, 2, ... , 50}$ with equal probability. The non-integer values are much less likely, since the odds of the two middle points hitting the boundary is low. The integers values do tend to a Guassian.



          middleMean[n_, range_] := Module[{res}, 
          res = Sort@Table[RandomChoice[Range[range]], {n}];
          Mean[{res[[n/2]], res[[n/2 + 1]]}]
          ]

          Histogram[Table[middleMean[500, 50], {1000}], 50]


          enter image description here






          share|improve this answer











          $endgroup$













          • $begingroup$
            If you plot all possible mean outcomes instead of only 0, 1/2, and 1, then you see that the central limit theorem still applies and you still get a Gaussian as $ntoinfty$.
            $endgroup$
            – Roman
            8 hours ago










          • $begingroup$
            For my discrete uniform, the $x$ can only take 0 or 1, which means the average of the two middle points can only take values 0, 1/2, or 1. So no way to get a distribution over anything else. It is a bit contrived, but interesting.
            $endgroup$
            – MikeY
            3 hours ago
















          1












          $begingroup$

          Here's an interesting counter-example for a discrete uniform distribution does not tend to your shape as $N$ grows.



          Let your r.v. $x$ be distributed as per a coin toss, taking value ${0,1}$ with equal probability. Then you have three possible outcomes after $N$ coin tosses; $0, 1/2$ , or $1$



          The middle outcome's probability is the probability that with $N$ coin tosses you get exactly $N/2$ zeros or ones. This probability is



          $$
          2^{-n} binom{n}{frac{n}{2}}
          $$



          Which decreases in $N$, resulting in the plot below, with the distribution of probabilities of values with $N$



          enter image description here



          EDIT



          You can see the same effect with the discrete distribution for $x$ expanded to take values $x={1, 2, ... , 50}$ with equal probability. The non-integer values are much less likely, since the odds of the two middle points hitting the boundary is low. The integers values do tend to a Guassian.



          middleMean[n_, range_] := Module[{res}, 
          res = Sort@Table[RandomChoice[Range[range]], {n}];
          Mean[{res[[n/2]], res[[n/2 + 1]]}]
          ]

          Histogram[Table[middleMean[500, 50], {1000}], 50]


          enter image description here






          share|improve this answer











          $endgroup$













          • $begingroup$
            If you plot all possible mean outcomes instead of only 0, 1/2, and 1, then you see that the central limit theorem still applies and you still get a Gaussian as $ntoinfty$.
            $endgroup$
            – Roman
            8 hours ago










          • $begingroup$
            For my discrete uniform, the $x$ can only take 0 or 1, which means the average of the two middle points can only take values 0, 1/2, or 1. So no way to get a distribution over anything else. It is a bit contrived, but interesting.
            $endgroup$
            – MikeY
            3 hours ago














          1












          1








          1





          $begingroup$

          Here's an interesting counter-example for a discrete uniform distribution does not tend to your shape as $N$ grows.



          Let your r.v. $x$ be distributed as per a coin toss, taking value ${0,1}$ with equal probability. Then you have three possible outcomes after $N$ coin tosses; $0, 1/2$ , or $1$



          The middle outcome's probability is the probability that with $N$ coin tosses you get exactly $N/2$ zeros or ones. This probability is



          $$
          2^{-n} binom{n}{frac{n}{2}}
          $$



          Which decreases in $N$, resulting in the plot below, with the distribution of probabilities of values with $N$



          enter image description here



          EDIT



          You can see the same effect with the discrete distribution for $x$ expanded to take values $x={1, 2, ... , 50}$ with equal probability. The non-integer values are much less likely, since the odds of the two middle points hitting the boundary is low. The integers values do tend to a Guassian.



          middleMean[n_, range_] := Module[{res}, 
          res = Sort@Table[RandomChoice[Range[range]], {n}];
          Mean[{res[[n/2]], res[[n/2 + 1]]}]
          ]

          Histogram[Table[middleMean[500, 50], {1000}], 50]


          enter image description here






          share|improve this answer











          $endgroup$



          Here's an interesting counter-example for a discrete uniform distribution does not tend to your shape as $N$ grows.



          Let your r.v. $x$ be distributed as per a coin toss, taking value ${0,1}$ with equal probability. Then you have three possible outcomes after $N$ coin tosses; $0, 1/2$ , or $1$



          The middle outcome's probability is the probability that with $N$ coin tosses you get exactly $N/2$ zeros or ones. This probability is



          $$
          2^{-n} binom{n}{frac{n}{2}}
          $$



          Which decreases in $N$, resulting in the plot below, with the distribution of probabilities of values with $N$



          enter image description here



          EDIT



          You can see the same effect with the discrete distribution for $x$ expanded to take values $x={1, 2, ... , 50}$ with equal probability. The non-integer values are much less likely, since the odds of the two middle points hitting the boundary is low. The integers values do tend to a Guassian.



          middleMean[n_, range_] := Module[{res}, 
          res = Sort@Table[RandomChoice[Range[range]], {n}];
          Mean[{res[[n/2]], res[[n/2 + 1]]}]
          ]

          Histogram[Table[middleMean[500, 50], {1000}], 50]


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 2 hours ago

























          answered 8 hours ago









          MikeYMikeY

          4,0539 silver badges16 bronze badges




          4,0539 silver badges16 bronze badges












          • $begingroup$
            If you plot all possible mean outcomes instead of only 0, 1/2, and 1, then you see that the central limit theorem still applies and you still get a Gaussian as $ntoinfty$.
            $endgroup$
            – Roman
            8 hours ago










          • $begingroup$
            For my discrete uniform, the $x$ can only take 0 or 1, which means the average of the two middle points can only take values 0, 1/2, or 1. So no way to get a distribution over anything else. It is a bit contrived, but interesting.
            $endgroup$
            – MikeY
            3 hours ago


















          • $begingroup$
            If you plot all possible mean outcomes instead of only 0, 1/2, and 1, then you see that the central limit theorem still applies and you still get a Gaussian as $ntoinfty$.
            $endgroup$
            – Roman
            8 hours ago










          • $begingroup$
            For my discrete uniform, the $x$ can only take 0 or 1, which means the average of the two middle points can only take values 0, 1/2, or 1. So no way to get a distribution over anything else. It is a bit contrived, but interesting.
            $endgroup$
            – MikeY
            3 hours ago
















          $begingroup$
          If you plot all possible mean outcomes instead of only 0, 1/2, and 1, then you see that the central limit theorem still applies and you still get a Gaussian as $ntoinfty$.
          $endgroup$
          – Roman
          8 hours ago




          $begingroup$
          If you plot all possible mean outcomes instead of only 0, 1/2, and 1, then you see that the central limit theorem still applies and you still get a Gaussian as $ntoinfty$.
          $endgroup$
          – Roman
          8 hours ago












          $begingroup$
          For my discrete uniform, the $x$ can only take 0 or 1, which means the average of the two middle points can only take values 0, 1/2, or 1. So no way to get a distribution over anything else. It is a bit contrived, but interesting.
          $endgroup$
          – MikeY
          3 hours ago




          $begingroup$
          For my discrete uniform, the $x$ can only take 0 or 1, which means the average of the two middle points can only take values 0, 1/2, or 1. So no way to get a distribution over anything else. It is a bit contrived, but interesting.
          $endgroup$
          – MikeY
          3 hours ago


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematica Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f201060%2fcould-this-problem-be-tackled-using-mathematica%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...