더북(TheBook)

또한, “그 값이 최소한 1만큼 차이가 날 확률은 얼마인가? 또는 2? 5? 10?”과 같은 더 복잡한 문제를 계산할 수 있다.

 


# abs(lambda_1_samples - lambda_2_samples) > 1은 불 벡터다.
# 값이 1 이상이면 True, 그렇지 않으면 False다.
# 얼마나 자주 발생하는가? .mean()을 사용한다.
for d in [1,2,5,10]:
    v = (abs(lambda_1_samples-lambda_2_samples)>=d).mean()
    print(“What is the probability the difference is larger than %d? %.2f%(d,v))

 

 

결과

What is the probability the difference is larger than 1? 1.00
What is the probability the difference is larger than 2? 1.00
What is the probability the difference is larger than 5? 0.49
What is the probability the difference is larger than 10? 0.00

신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.