0
$\begingroup$

This question is based slightly on https://www.reddit.com/r/AskStatistics/comments/16bqit0/calculating_probability_when_phacking_is_allowed/

Given a variable $X$, let $A_j$ be the average of $X_1$ through $X_j$, and consider the maximum $M(k,n)$ of the averages $A_k$ through $A_n$. What is the distribution of $M(k,n)$, and what are its mean, variance, skew and kurtosis?

Example using Mathematica and the standard normal distribution:



(* Generate 10 numbers from the standard normal distribution *)

In[4]:= t0 = RandomVariate[NormalDistribution[], 10]

Out[4]= {1.1326638767757509, 1.3721132237125009, 0.23425376432530973, 
0.20784973932824719, -0.5254057319068096, -0.6022325311764837, 
-1.5923278708572994, 0.7216000821527218, -0.9347445208908779, 
-1.2687444762907945}

(* compute the running sum and then divide it to get the running average *)

In[9]:= t1 = Accumulate[t0]/Table[i,{i,1,10}]

Out[9]= {1.1326638767757509, 1.2523885502441259, 0.913010288271187,
0.7367201510354521, 0.48429497444699976, 0.30320705684308585,
0.03241635288588797, 0.1185643190442422, 0.0015300034958955178,
-0.1254974444827735}

(* find the max of the 7th through 10th element *)

In[11]:= t2 = Max[Take[t1, {7, 10}]]

Out[11]= 0.118564

If you repeat the above a million times (not shown, but more code below), the resulting list has a mean of 0.109603, a variance of 0.114528, a skew of 0.0605243, and a kurtosis of 3.03414. Of course, results vary since these are random trials.

Here's the Mathematica code to compute for any distribution, any values of k and n and a given number of runs. It returns the mean, variance, skew and kurtosis I describe above, as well as those values for the original distribution for reference.



g[dist_, k_, n_, runs_] := Module[{vals}, 
    vals = Table[Max[Take[Accumulate[Table[RandomVariate[dist], {i, 1, n}]]/
          Table[i, {i, 1, n}], {k, n}]], {j, 1, runs}]; 
     Return[{exp -> {mean -> Mean[vals], var -> Variance[vals], 
         skew -> Skewness[vals], kurt -> Kurtosis[vals]}, 
       base -> {mean -> Mean[dist], var -> Variance[dist], 
         skew -> Skewness[dist], kurt -> Kurtosis[dist]}}]]

(* sample usage *)

In[14]:= g[NormalDistribution[], 7, 10, 10^6]                                   
{exp -> {mean -> 0.10960304779225989, var -> 0.11452773128641285, 
   skew -> 0.060524316866107375, kurt -> 3.0341431199559623}, 
 base -> {mean -> 0, var -> 1, skew -> 0, kurt -> 3}}

Is there a general formula here as runs -> infinity?

NOTE: I'm aware this is a type of ordered probability distribution, but I haven't seen any results for this exact question.

$\endgroup$
4
  • $\begingroup$ The CDF of the max of $n-k+1$ iid values from a distribution $F$ is $F^{n-k+1}.$ Go on from there. $\endgroup$
    – whuber
    Commented Sep 10, 2023 at 18:29
  • $\begingroup$ I actually looked into that (it was one of my first suggestions in the reddit post), but, for a given sequence of numbers, the 10th and 11th running averages aren't independent, for example $\endgroup$ Commented Sep 11, 2023 at 13:55
  • $\begingroup$ Why does that matter?? $\endgroup$
    – whuber
    Commented Sep 11, 2023 at 17:56
  • $\begingroup$ So it doesn't meet the iid condition, though now I sense I'm missing something $\endgroup$ Commented Sep 12, 2023 at 20:02

1 Answer 1

1
$\begingroup$

Consider the expected value of the maximum of $n$ standard normal variables. We have no general closed-form formula for that, so there is little hope of a formula for the more complicated quantity in the question.

$\endgroup$
6
  • $\begingroup$ As @whuber notes, we can cheat by giving a name to the CDF of the normal distribution (Erf) and exponentiating it to get the CDF of the max. If we then differentiate to find the PDF we might even end up with something in closed form $\endgroup$ Commented Sep 18, 2023 at 16:46
  • $\begingroup$ Good luck with that…even with Erf and InverseErf functions we have no closed form for the expectation I mentioned. $\endgroup$
    – user225256
    Commented Sep 18, 2023 at 16:53
  • $\begingroup$ We have close form PDFs, no? I haven't checked, but it seems we should $\endgroup$ Commented Sep 18, 2023 at 16:56
  • $\begingroup$ The PDF of the max of iid normals is in closed form if you allow Erf — but its expectation is an integral for which we have no closed form. And the max in the question is not a max of iid variables, so it may not even have a closed-form pdf that works for all $k$ and $n$. $\endgroup$
    – user225256
    Commented Sep 18, 2023 at 17:46
  • $\begingroup$ Isn't the PDF of the standard normal of the form e^(-x^2) or something. Also, I was replying to your "even with Erf and InverseErf functions we have no closed form for the expectation", not the original problem $\endgroup$ Commented Sep 19, 2023 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.