由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Quant版 - 问一个面试题,关于概率的
相关主题
old probability Q掷硬币问题
大家来扔硬币-an interview question又见coin 难题
[Markov Chain] 世界矿工的一道笔试题[合集] another interesting probability problem
[合集] a probability question[合集] 一道概率题,被问倒了。
请教2道概率题A probability Q
dice problem[合集] 问一个概率题
【Probability】a problemtoss a coin 100 times, what's the probability at least 60 of them are heads?
有两道题目求解[合集] Probability Question
相关话题的讨论汇总
话题: ith话题: prev话题: visited话题: prob话题: 63
进入Quant版参与讨论
1 (共1页)
n*******t
发帖数: 67
1
Roll a die repeatedly until the sum goes above 63. What is the probability
that the second to last value was X. Make a market on this probability. i.e.
what is your 90 percent confidence interval.
完全没想法……
l*******1
发帖数: 113
2
P(63-x) = (6-x)/21
x is 0 to 5
k*****n
发帖数: 117
3
a + X + X ... X > 63
given X,
suppose you roll a first, then you need to roll consecutive K Xs'
K = floor((64-a)/X)
the prob conditioned on having a on the first roll is
(1/6)^K
Summing up all a, the prob of the event is
\sum_a_1_6 {(1/6)^floor((64-a)/X))}
which can be easily computed
n*******t
发帖数: 67
4
…… second to last 的意思是倒数第二,不是从第二个到最后一个。

【在 k*****n 的大作中提到】
: a + X + X ... X > 63
: given X,
: suppose you roll a first, then you need to roll consecutive K Xs'
: K = floor((64-a)/X)
: the prob conditioned on having a on the first roll is
: (1/6)^K
: Summing up all a, the prob of the event is
: \sum_a_1_6 {(1/6)^floor((64-a)/X))}
: which can be easily computed

n*******t
发帖数: 67
5
如果问的是最后一个toss是X的概率,我理解了,为什么倒数第二个是X的概率也是这个
呢?

【在 l*******1 的大作中提到】
: P(63-x) = (6-x)/21
: x is 0 to 5

k*****n
发帖数: 117
6
2nd try:
Let P(N,X) represent the probability of N is reached by the process, with
the second last roll being X
Since the process guarantees N increases with more rolls,
P(1,~) + P(2,~) + ... P(Inf,~) = 0
each of them is a marginal probability.
Now condition on the last roll a, we have
P(N,X) = \sum_a_1_6 {P(N-X-a,~)/6}
Initial condition
P(a,a) = 1,
P(a,b) = 0 for b<>a. for all 1<=a,b<=6
k*****n
发帖数: 117
7
correction
Let P(N,X) be the prob of reaching N with *LAST* roll being X
then P(N,X) = \sum_a_1_6{P(N-X,a)/6}
Initial: P(1,1) = 1, P(1,a)=0 for a>1.
The final answer is
P(58,X)/6 + P(59,X)*2/6 + P(60,X)*3/6 + P(61,X)*4/6 + P(62,X)*5/6 + P(63,X)*
6/6

【在 k*****n 的大作中提到】
: 2nd try:
: Let P(N,X) represent the probability of N is reached by the process, with
: the second last roll being X
: Since the process guarantees N increases with more rolls,
: P(1,~) + P(2,~) + ... P(Inf,~) = 0
: each of them is a marginal probability.
: Now condition on the last roll a, we have
: P(N,X) = \sum_a_1_6 {P(N-X-a,~)/6}
: Initial condition
: P(a,a) = 1,

r**a
发帖数: 536
8

)*
你这个最后结果可以直接用implied tree写出来。你画两列数组,最后一列为64到69,
第一列从58到63.从58到最后一列只有一种办法-加上6。这个就是你的第一项P(58,X)/6
。类比下去你可以得到其他项。

【在 k*****n 的大作中提到】
: correction
: Let P(N,X) be the prob of reaching N with *LAST* roll being X
: then P(N,X) = \sum_a_1_6{P(N-X,a)/6}
: Initial: P(1,1) = 1, P(1,a)=0 for a>1.
: The final answer is
: P(58,X)/6 + P(59,X)*2/6 + P(60,X)*3/6 + P(61,X)*4/6 + P(62,X)*5/6 + P(63,X)*
: 6/6

s***e
发帖数: 267
9
You may use recursion to compute but I will be surprised if the result is
significantly different from randomly rolling the die. The difference should
be minimum given your number (i.e. stop when sum is > 63).

probability
e.

【在 n*******t 的大作中提到】
: Roll a die repeatedly until the sum goes above 63. What is the probability
: that the second to last value was X. Make a market on this probability. i.e.
: what is your 90 percent confidence interval.
: 完全没想法……

k*******a
发帖数: 772
10
from simulation
1 to 6 each has probability of 1/6
w*******x
发帖数: 489
11
good
我感觉也是,除了最后一个,应该都是1/6的均匀分布。

【在 k*******a 的大作中提到】
: from simulation
: 1 to 6 each has probability of 1/6

k*****y
发帖数: 744
12
int main()
{
const int N = 63;
const int MAX = N + 6;
double prob[ MAX+1 ];
double ans[ MAX+1 ];
double visit[ MAX+1 ];
for( int ith=0; ith<=MAX; ++ith ){
prob[ ith ] = ( ith>=1 && ith<=6 ) ? 1./6 : 0;
ans[ ith ] = 0; visit[ ith ] = 0;
}

for( int runtime=2; runtime<=MAX; ++runtime ){
for( int ith=MAX; ith>=0; --ith ){
if( ith <= N) prob[ ith ] = 0; // reset if the state is
transient

for( int num=1; num<= 6; ++num ) {
prob[ ith ] += (ith-num>=0) ? prob[ ith-num ]/6 : 0 ;
if( ith>N && ith-num>=0 )
ans[ ith-num ] += prob[ ith-num ]/6;
}
visit[ ith ] += prob[ ith ];
}
}
for( int ith=N-5; ith<=N; ++ith ){
printf("P( prev = %d ) = %.10llf\n", ith, ans[ ith ] );
printf("P( prev = %d ) ~ %.10llf\n", ith, double(ith+6-N)/21 );
}
for( int ith=N-5; ith<=N; ++ith )
printf("P( visited %d ) = %.10llf\n", ith, visit[ ith ] );

return 0;
}
======================================
output:
P( prev = 58 ) = 0.0476190474
P( prev = 58 ) ~ 0.0476190476
P( prev = 59 ) = 0.0952380958
P( prev = 59 ) ~ 0.0952380952
P( prev = 60 ) = 0.1428571437
P( prev = 60 ) ~ 0.1428571429
P( prev = 61 ) = 0.1904761906
P( prev = 61 ) ~ 0.1904761905
P( prev = 62 ) = 0.2380952374
P( prev = 62 ) ~ 0.2380952381
P( prev = 63 ) = 0.2857142851
P( prev = 63 ) ~ 0.2857142857
P( visited 58 ) = 0.2857142842
P( visited 59 ) = 0.2857142873
P( visited 60 ) = 0.2857142875
P( visited 61 ) = 0.2857142859
P( visited 62 ) = 0.2857142849
P( visited 63 ) = 0.2857142851
======================================
lukas1421's answer is fairly close.
I guess the rough idea is that you can identify almost all sample paths
visiting K with those visiting K+1 for K large. Based on this, I guess one
can find lukas1421's formula.

【在 l*******1 的大作中提到】
: P(63-x) = (6-x)/21
: x is 0 to 5

d*******e
发帖数: 24
13
各个值的概率近似相等,大约是1/6
let X be the second to last toss, Y be the last toss, S be the total sum, S'
be the total sum except for the last two tosses
for any x=1..6, y=1..6, s=64..63+y
P(X=x, Y=y, S(N)=s) = P(X=x, Y=y, S=s, S'=s-x-y)
= P(X=x, Y=y, S'=s-x-y)
= P(visited s-x-y, then toss x, then toss y)
= P(visited s-x-y)/36
~= 1/126
(Approximation: P(visited s-x-y) ~= 1/3.5)
Thus P(X=x) ~= 1/126 * (1+2+3+4+5+6) = 1/6 for all x
1 (共1页)
进入Quant版参与讨论
相关主题
[合集] Probability Question请教2道概率题
[合集] probability 问题dice problem
某hedge fund面试题一道【Probability】a problem
another interesting probability question有两道题目求解
old probability Q掷硬币问题
大家来扔硬币-an interview question又见coin 难题
[Markov Chain] 世界矿工的一道笔试题[合集] another interesting probability problem
[合集] a probability question[合集] 一道概率题,被问倒了。
相关话题的讨论汇总
话题: ith话题: prev话题: visited话题: prob话题: 63