Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Secretary_Game_With_Rejection.pdf
1. In[31]:= A[k_, m_] = Gamma[m + 2] / Gamma[k + 1] / Gamma[m - k + 1];
(*expected value of x*)
xexp[k_, m_, n_] = A[k, m] / 2 *
NIntegrate[x^(m - k) * (1 - x)^k * (x * x^(1 - m + n) + (1 + x) * (1 - x^(1 - m + n))), {x, 0, 1}];
N[xexp[3, 37, 0, 100]]
NIntegrate: The integrand (1 - x)k
x-k+m
x2-m+n
+ (1 + x) 1 - x1+Times[2]+n
has evaluated to non-numerical
values for all sampling points in the region with boundaries {{0, 1}}.
NIntegrate: The integrand (1 - x)k
x-k+m
x2-m+n
+ (1 + x) 1 - x1+Times[2]+n
has evaluated to non-numerical
values for all sampling points in the region with boundaries {{0, 1}}.
Out[33]= 0.940033
In[27]:= Integrate[(n - m + 1) * y^(n - m), {y, 0, x}]
Out[27]= x1-m+n
if Re[m - n] < 1
(*now we need to adjust for the rate of being rejected*)
success[n_, m_, x_] = (1 - x^(1 - m + n));
failure[n_, m_, x_] = x^(1 - m + n);
(*r is the acceptance rate*)
(*the question we are asking
is: given that the greatest point in the test set is greater than x,
how many points are greater than x*)
(*we have to untangle success again*)
successold[n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m), {y, x, 1}];
(*now given y, we can set up the space between
x and y and compare it to the space below y itself*)
(*deprecated, see below*)
(*greaterx[n_,m_,x_]=Integrate[(n-m+1)*y^(n-m)*(y-x)/y*(n-m),{y,x,1}]*)
(*for each greater than x point y,
we find the number of points that are between x and y, then add them together*)
rejected[n_, m_, x_, r_] = success[n, m, x] * (1 - r)^(greaterx[n, m, x]);
notrejected[n_, m_, x_, r_] = success[n, m, x] * (1 - (1 - r)^(greaterx[n, m, x]));
xexp[k_, m_, n_, r_] =
A[k, m] / 2 * NIntegrate[x^(m - k) * (1 - x)^k * (x * (failure[n, m, x] + rejected[n, m, x, r]) +
(1 + x) * notrejected[n, m, x, r]), {x, 0, 1}];
Plot[N[success[100, 37, x]], {x, 0, 1}, PlotRange → {-0.1, 1}]
(*makes sense, if the first number is large, it's hard to beat it*)
Plot[N[rejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}]
Plot[N[notrejected[100, 37, x, 0.1]], {x, 0, 1}, PlotRange → {-0.1, 1}]
5. In[140]:= Plot[xexp[k, 37, 100, 0.1], {k, 1, 15}]
Out[140]=
2 4 6 8 10 12 14
0.60
0.65
0.70
0.75
(*looks like 0.76 and only top 11 or so*)
In[141]:= Plot3D[xexp[k, m, 100, 0.1], {k, 1, 20}, {m, 1, 40}]
Out[141]=
(*it looks like it's telling me top 1 and fire after 4 trials*)
In[176]:= Quiet[FindMaximum[xexp[k, m, 100, 0.1], {k, 10}, {m, 37}]]
Out[176]=
{0.770144, {k → 11.2483, m → 35.5792}}
In[177]:= Quiet[FindMaximum[xexp[k, m, 100, 0.1], {k, 1}, {m, 4}]]
Out[177]=
{0.794735, {k → 3.64866, m → 14.252}}
In[179]:= Quiet[FindMaximum[{xexp[k, m, 100, 0.1], 1 ≤ k ≤ 15, 1 ≤ m ≤ 40}, {k, m}]]
Out[179]=
{0.794735, {k → 3.64867, m → 14.252}}
5
6. (*seems like there could be other local maxima but the global one is at k=
3.65 and m = 14.3*)
In[180]:= Quiet[FindMaximum[{xexp[k, m, 1000, 0.1], 1 ≤ k ≤ 50, 1 ≤ m ≤ 400}, {k, m}]]
Out[180]=
{0.962388, {k → 9.65589, m → 171.697}}
In[184]:= Quiet[FindMaximum[{xexp[k, m, 10 000, 0.1], 10 ≤ k ≤ 50, 1000 ≤ m ≤ 2000}, {k, m}]]
Out[184]=
{0., {k → 19.2022, m → 1085.2}}
(*and then it just broke*)
In[185]:= Quiet[FindMaximum[{xexp[k, m, 200, 0.1], 1 ≤ k ≤ 15, 1 ≤ m ≤ 40}, {k, m}]]
Out[185]=
{0.871543, {k → 5.4209, m → 31.5675}}
In[188]:= Quiet[FindMaximum[{xexp[k, m, 300, 0.1], 1 ≤ k ≤ 15, 1 ≤ m ≤ 60}, {k, m}]]
Out[188]=
{0.904275, {k → 6.48495, m → 48.9963}}
(*another thing to consider is that (1-r)^(greaterx[n,m,x]) is log-normal,
not normal*)
In[191]:= greaterx["mean"][n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m) * (y - x) / y * (n - m), {y, x, 1}]
greaterx["var"][n_, m_, x_] = Integrate[(n - m + 1) * y^(n - m) * (y - x) / y * x / y * (n - m), {y, x, 1}]
Out[191]=
-
(-m + n) (1 - m + n) m + n (-1 + x) + x - m x - x1-m+n
(-1 + m - n) (m - n)
if condition
Out[192]=
-
(-m + n) (1 - m + n) x 1 + m + n (-1 + x) - m x - x-m+n
(m - n) (1 + m - n)
if condition
In[197]:= (*I need the mean of (1-r)^(Gaussian) - it's mu + var/2. aside: we have ln[term]=
log(1-r)*Gaussian, this factor doesn't influence mean or std*)
greaterx[n_, m_, x_] = greaterx["mean"][n, m, x] + greaterx["var"][n, m, x] / 2
Out[197]=
-
(-m + n) (1 - m + n) x 1 + m + n (-1 + x) - m x - x-m+n
2 (m - n) (1 + m - n)
-
(-m + n) (1 - m + n) m + n (-1 + x) + x - m x - x1-m+n
(-1 + m - n) (m - n)
if condition
6
14. (*so the median person has it considerably worse than the mean person -
which one am I*)
(*I think I am the mean person. The reason is that the log-
normal distribution gets integrated over all outcomes of the first trial-
phase so that means it becomes Gaussian again
due to the Central Limit Theorem - am I wrong?*)
14