AllenDowney / ThinkStats2

Text and supporting code for Think Stats, 2nd Edition
http://allendowney.github.io/ThinkStats2/
GNU General Public License v3.0
4.02k stars 11.28k forks source link

Exercise 3.4 #125

Closed KeyaVibhakar closed 5 years ago

KeyaVibhakar commented 5 years ago

Could you please explain, why we multiply diff (which is; the difference between the runner's speed and observer's speed) with the probability of a given runner's speed; to get the biased data?

`def ObservedPmf(pmf, speed, label=None):

new = pmf.Copy(label=label)
for val in new.Values():
    diff = abs(val - speed)
    new.Mult(val, diff)
new.Normalize()
return new

`

AllenDowney commented 5 years ago

Because the probability of observing any runner is proportional to the difference between their speed and mine.

On Wed, Mar 13, 2019, at 7:48 AM, KeyaVibhakar wrote:

Could you please explain, why we multiply diff (which is; the difference between the runner's speed and observer's speed) with the probability of a given runner's speed; to get the biased data?

`def ObservedPmf(pmf, speed, label=None):

new = pmf.Copy(label=label) for val in new.Values(): diff = abs(val - speed) new.Mult(val, diff) new.Normalize() return new `

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/AllenDowney/ThinkStats2/issues/125#issuecomment-472390062, or mute the thread https://github.com/notifications/unsubscribe-auth/ABy37WCnzfL9SzcP5501wOhNmr1PXvZ8ks5vWOWHgaJpZM4btA6e.

KeyaVibhakar commented 5 years ago

Thank you!