1. #1
    illfuuptn
    illfuuptn's Avatar Become A Pro!
    Join Date: 03-17-10
    Posts: 1,860

    Statistics help

    Okay I need a little help with the concept of bayesion updating.

    -Say I have the prior belief that event A happens 94 percent of the time and B happens 6 percent.

    -Either A or B happens(there is no in-between).

    -The next event that occurs is B.

    -I'm trying to find a posterior probability of A given that B occured.

    P(A)=.94
    P(B)=.06
    P(B|A)=.06
    P(A|B)=?

    Using Bayes Theorem:
    (.94 x .06)/.06=.94 which is the same as the prior probability...

    Where am I going wrong? I'm assuming I'm wrong on either P(B)=.06 or P(B|A)=.06

  2. #2
    samserif
    samserif's Avatar Become A Pro!
    Join Date: 09-19-11
    Posts: 63
    Betpoints: 165

    Your calculation's correct, so if this isn't what you expect, then at least one of your P's is wrong. When you say P(B) = 0.06 and P(B|A) = 0.06, you're saying that knowing A doesn't change your belief in B, so basically A has no effect on B. What Bayes' Theorem is telling you is that if this is the case, B also doesn't tell you anything about A.

    Can you describe what A and B represent?

  3. #3
    illfuuptn
    illfuuptn's Avatar Become A Pro!
    Join Date: 03-17-10
    Posts: 1,860

    A represents making a free throw
    B represents missing a free throw

    My prior assumption is that someone shoots 94%, however, given that they miss a shot, shouldn't I be able to use Bayes' Theorem to come up with a revised probability?

  4. #4
    LLXC
    LLXC's Avatar SBR PRO
    Join Date: 12-10-06
    Posts: 8,969
    Betpoints: 10451

    Sounds like independent events.

  5. #5
    samserif
    samserif's Avatar Become A Pro!
    Join Date: 09-19-11
    Posts: 63
    Betpoints: 165

    I'm still not sure I understand. If A and B are consecutive free throws, you're saying that P(A)=.94 (94% chance of making the first) and P(B)=0.06 (6% chance of making the second), regardless of the outcome of the first?

    From your description, it sounds like you're looking for this:
    P(B|A) = probability of making the second shot given that the player made the first
    P(B|-A) = probability of making the second shot given that the player missed the first

    Is this right? If so, you don't need Bayes' Theorem, rather just a set of frequencies. If you had this, then Bayes' Theorem would tell you the probability that the player made the first shot given that he made the second shot... which seems like a strange question to ask (or maybe I just don't get it).

  6. #6
    illfuuptn
    illfuuptn's Avatar Become A Pro!
    Join Date: 03-17-10
    Posts: 1,860

    Quote Originally Posted by samserif View Post
    I'm still not sure I understand. If A and B are consecutive free throws, you're saying that P(A)=.94 (94% chance of making the first) and P(B)=0.06 (6% chance of making the second), regardless of the outcome of the first?

    From your description, it sounds like you're looking for this:
    P(B|A) = probability of making the second shot given that the player made the first
    P(B|-A) = probability of making the second shot given that the player missed the first

    Is this right? If so, you don't need Bayes' Theorem, rather just a set of frequencies. If you had this, then Bayes' Theorem would tell you the probability that the player made the first shot given that he made the second shot... which seems like a strange question to ask (or maybe I just don't get it).
    No I'm saying that I BELIEVE that the player shoots 94%. But given that I see him miss the free throw I should adjust my assumption to a different percentage. Is that not what Bayesion updating is supposed to accomplish?

  7. #7
    RickySteve
    SBR is a criminal organization
    RickySteve's Avatar Become A Pro!
    Join Date: 01-31-06
    Posts: 3,415
    Betpoints: 187

    Quote Originally Posted by LLXC View Post
    Sounds like independent events.
    I mock you openly.

  8. #8
    sharpcat
    sharpcat's Avatar Become A Pro!
    Join Date: 12-19-09
    Posts: 4,516

    If the player has a 94% chance of making any given free throw and he misses the first free throw than his chance of making the next free throw is still 94%. There has been no new information provided that would effect the outcome of the next free throw.

  9. #9
    samserif
    samserif's Avatar Become A Pro!
    Join Date: 09-19-11
    Posts: 63
    Betpoints: 165

    I think I see what's going on. I didn't read this literally:

    Quote Originally Posted by illfuuptn View Post
    A represents making a free throw
    B represents missing a free throw
    You're using two different symbols, A and B, to represent the same random variable. Let's just call this free throw A, and then write:

    P(A) = 0.94
    P(-A) = 0.06 (where "-" means "not", i.e. "-A" means a miss)

    If there were more than two outcomes, you'd write it differently. Suppose we're talking about football passes instead of free throws. Then you'd write P(A=complete), P(A=incomplete), and P(A=intercept). You'd also write it this way if it wasn't clear that one value is a success and one's a failure (which is the case with free throws).

    Bayes' Theorem applies to multiple variables, some of which are evidence and others of which are hypotheses. Otherwise, you end up asking things things like "What's the probability that this player makes a free throw given I just saw him make a free throw...uh, say what?". It's useful when you're asking questions like, "I know the probability of seeing the evidence if the hypothesis is true, so if I now actually see the evidence, what's the probability that the hypothesis is in fact true?" You know (or have a strong opinion about) P(B|A), and you observe B, so now you're asking what's the probability of A given B, i.e., P(A|B).

    If you're trying to figure out a player's free throw percentage based on observations, you've already got everything you need to figure out the mean and the confidence interval -- no need to get all Bayesian.

    Or, were you trying to estimate whether a player is a good or bad shooter without knowing anything else about him? Then you've got two legitimate variables:

    A = player's shooting ability. Two values (for simplicity): good, bad. This is your hypothesis.
    B = observed free throw. Two values: success, failure. This is your evidence.

    Now you can think about stuff like:

    "What's the probability that any player in the league will make a free throw?" = P(B)
    "What's the probability that a good player will make a free throw?" = P(B | A=good)
    "What's the probability that a bad player will make a free throw?" = P(B | A=bad)
    "What's the probability that he's a good shooter, without knowing anything else?" = P(A=good)

    and then use Bayes' theorem to answer the question:

    "What's the probability he's good, given that I just saw him make a free throw?" P(A=good | B)

    Is this what you had in mind?
    Last edited by samserif; 01-11-12 at 11:40 AM. Reason: Fixed typos, changed variable names for clarity

  10. #10
    uva3021
    uva3021's Avatar Become A Pro!
    Join Date: 03-01-07
    Posts: 537
    Betpoints: 381

    it's 50%,

    P(A)*P(B|A) / [P(A)*P(B|A)+P(~A)*P(B|~A)]

    though intuitively that does not seem right at all, thus your P(B|A) is way off

  11. #11
    bztips
    bztips's Avatar Become A Pro!
    Join Date: 06-03-10
    Posts: 283

    You're making a mountain out of a molehill.

    The 94% figure has to be based on some number of observations -- let's say it's 100 (he made 94 of his first 100 free throws). Now he misses his next one, so your best estimate of his true shooting ability is now 94/101 = 93.07%. Done.

  12. #12
    illfuuptn
    illfuuptn's Avatar Become A Pro!
    Join Date: 03-17-10
    Posts: 1,860

    Quote Originally Posted by bztips View Post
    You're making a mountain out of a molehill.

    The 94% figure has to be based on some number of observations -- let's say it's 100 (he made 94 of his first 100 free throws). Now he misses his next one, so your best estimate of his true shooting ability is now 94/101 = 93.07%. Done.
    This isn't necessarily true. If we used this method to update player's skills we would be in a world of trouble imo. If ellsbury had a career average of .280 and we just kept using the quoted method to update his average last during last season, he would've been underrated for the entire season. His true performance was higher last year. That's something that Bayes' Theorem can show...or so I think.

  13. #13
    illfuuptn
    illfuuptn's Avatar Become A Pro!
    Join Date: 03-17-10
    Posts: 1,860

    Quote Originally Posted by uva3021 View Post
    it's 50%,

    P(A)*P(B|A) / [P(A)*P(B|A)+P(~A)*P(B|~A)]

    though intuitively that does not seem right at all, thus your P(B|A) is way off
    Can you please elaborate on this? Shouldn't P(B|A) be the probability he misses the free throw given that he shoots 94%? If so, there is no way to inaccurately estimate that. However, it is definitely possible to make a misestimate of P(A).

    As for the formula, wouldn't I just get 50% EVERY time? If I tried to do another update if he makes another free throw, it would be...

    .5*.5/[.5*.5+.5*.5]

    Can you explain though, because I don't really know what P(~A) and P(B|~A) represent? I just assumed ~A meant the complement of A, but couldn't that also be stated as P(B) in this case? IDK, I'm obviously confused.

  14. #14
    uva3021
    uva3021's Avatar Become A Pro!
    Join Date: 03-01-07
    Posts: 537
    Betpoints: 381

    Quote Originally Posted by illfuuptn View Post
    Can you please elaborate on this? Shouldn't P(B|A) be the probability he misses the free throw given that he shoots 94%? If so, there is no way to inaccurately estimate that. However, it is definitely possible to make a misestimate of P(A).

    As for the formula, wouldn't I just get 50% EVERY time? If I tried to do another update if he makes another free throw, it would be...

    .5*.5/[.5*.5+.5*.5]

    Can you explain though, because I don't really know what P(~A) and P(B|~A) represent? I just assumed ~A meant the complement of A, but couldn't that also be stated as P(B) in this case? IDK, I'm obviously confused.
    ~ means negation, so yeah its the same as P(B)

  15. #15
    illfuuptn
    illfuuptn's Avatar Become A Pro!
    Join Date: 03-17-10
    Posts: 1,860

    From Wiki

    "In the more realistic situation when k is known and a is unknown, P(k|a) is a likelihood function of a. The posterior probability distribution function of a, after observing k, is:

    P(a|k)=P(k|a)*P(a)/[P(k|a)*P(a)*d*a]

    where a prior probability distribution function,P(a) , is available to express what was known about a before observing k."

    What is d? They didn't specify.
    Last edited by illfuuptn; 01-12-12 at 01:42 PM.

  16. #16
    bztips
    bztips's Avatar Become A Pro!
    Join Date: 06-03-10
    Posts: 283

    Quote Originally Posted by illfuuptn View Post
    This isn't necessarily true. If we used this method to update player's skills we would be in a world of trouble imo. If ellsbury had a career average of .280 and we just kept using the quoted method to update his average last during last season, he would've been underrated for the entire season. His true performance was higher last year. That's something that Bayes' Theorem can show...or so I think.
    You're not understanding. There's nothing in what I said that requires you to Ellsbury's career average as the baseline. If you believe, for example, that you should just use this year's data, or this week's data, as his baseline, then you're free to do so.

    (You're also misunderstanding the idea of "skill" and "true performance", but that's a whole nother discussion.)

    Even if you don't want to use (or don't have access to) counts of individual observations on which to update your estimate, you can do the following:

    Suppose you have an estimate that shows a mean shooting percentage of 94% with a std deviation of 5%. And now you obtain a second data set (maybe based on your own actual observations) showing a shooting percentage of 50% with a std deviation of 20%. The conventional way to merge those two sets of observations is to do a weighted average where the weights are the inverses of the variances.

    Since variance = square of std deviation, you have:

    New estimated shooting percentage = [(1/.05^2)*.94 + (1/.20^2)*.50] / [(1/.05^2) + (1/.20^2)], which yields 91.4%. This makes sense because it's much closer to the estimate that has less uncertainty.

  17. #17
    buby74
    buby74's Avatar Become A Pro!
    Join Date: 06-08-10
    Posts: 92
    Betpoints: 21207

    Why not use the beta distibution (which works out the probability of seeing the results actually observed if the players true success rate was 1%, 2% 3% etcetc)and then update it with the new data so if you had seen the guy previously go 5 of 6 a miss would affect your posterior belief by a lot more than if the guy had gone 94/100 and then you saw a miss

    I guess the really interesting situation is if you had no data on the player free throw skills

  18. #18
    illfuuptn
    illfuuptn's Avatar Become A Pro!
    Join Date: 03-17-10
    Posts: 1,860

    Quote Originally Posted by illfuuptn View Post
    From Wiki

    "In the more realistic situation when k is known and a is unknown, P(k|a) is a likelihood function of a. The posterior probability distribution function of a, after observing k, is:

    P(a|k)=P(k|a)*P(a)/[P(k|a)*P(a)*d*a]

    where a prior probability distribution function,P(a) , is available to express what was known about a before observing k."

    What is d? They didn't specify.
    ???

  19. #19
    rsigley
    rsigley's Avatar Become A Pro!
    Join Date: 02-23-08
    Posts: 304
    Betpoints: 186

    uh you ignored the integral part

    da = taking derivative with respect to a so when you integrate from 0 to 1 you are integrating with respect to a

  20. #20
    illfuuptn
    illfuuptn's Avatar Become A Pro!
    Join Date: 03-17-10
    Posts: 1,860

    Quote Originally Posted by rsigley View Post
    uh you ignored the integral part

    da = taking derivative with respect to a so when you integrate from 0 to 1 you are integrating with respect to a
    Yeah I stupidly thought that part wouldn't matter. Can you explain your post more in-depth? And am I on the right track at least? I certainly don't think the method in post #11 is a smart way to go and #16 doesn't seem in-line with the bayesian methodology you've talked about on 2p2. What am I missing?

  21. #21
    illfuuptn
    illfuuptn's Avatar Become A Pro!
    Join Date: 03-17-10
    Posts: 1,860

    Am I supposed to take the derivative of the equation that makes up my distribution? How would I calculate what my distribution's equation is? Is it even possible? It's obviously resting on the x-axis except for being at .06 when x is at 0 and .94 when x is at 1.

  22. #22
    illfuuptn
    illfuuptn's Avatar Become A Pro!
    Join Date: 03-17-10
    Posts: 1,860

    And why do I take the derivative and then integrate? Isn't that like taking a step back before taking a step forward? Won't it net me the same equation?

  23. #23
    buby74
    buby74's Avatar Become A Pro!
    Join Date: 06-08-10
    Posts: 92
    Betpoints: 21207

    No on the x axis if should go from 0% to 100% shooting accuracy and your y axis should be your confidence and that would have a peak at 94% if that is your best estimate. ( I am assuming that while you believe he is a 94% shooter you are not certain of this because if you are completely certain of this Bayes doent really apply as neatly pointed out by Cromwell's rule on the wiki page)

    To calculate your ditribution of beliefs I would start with the beta distribution if you have some data on that player already so if he has shot 9/10 the curve will be very wide and a miss will change it a lot but if he has shot 94/100 it will be much narrower and a single miss won't change things much.

    The equation in wiki is actually just integration, not integration followed by differentiation

  24. #24
    illfuuptn
    illfuuptn's Avatar Become A Pro!
    Join Date: 03-17-10
    Posts: 1,860

    Okay but I'm guessing it would be smarter to create my own distribution. So let's say I think he's 0% likely to be a 0%-49% ft shooter. Then I think he's 2% likely to be a 50% ft shooter, 3% to be 51%, and follow that pattern until 60% where he is 12% likely to be that. Then he's 1% for each value from 61% to 70%. Then he's 5% at 71% and 5% at 72%. Then 3% at 73%. Then he's 0% for the rest.

    I know the distribution is ******* retarded but, as you know, sports can't always be perfectly distributed using a commercial distribution. So how the hell do I find out the equation for the distribution I just defined?

    Then what do I do? Take the derivative? Integrate? I'm so confused...

  25. #25
    TomG
    TomG's Avatar Become A Pro!
    Join Date: 10-29-07
    Posts: 500

    if you have a non-parametric distribution like that and you want to use bayesian updating pretty sure you need to learn how to use a sampling process like gibbs or metropolis-hastings. pretty high level stuff i hope to take a course on it one day

  26. #26
    buby74
    buby74's Avatar Become A Pro!
    Join Date: 06-08-10
    Posts: 92
    Betpoints: 21207

    Multiply your prior probability by the liklihood of the event happening then nor malise so that the sum equals 1. This is your posterior probability.

    So in your weird looking distribution to add the new data that you have observed a miss, first take the 50% true ability and mulltiply 2%(your prprior) by 50%(liklihood of missing if he is truely a 50% shooter) this gives 1% do this for every value in your weird distribution and then sum you will get 42% according to my spreadsheet so divide 1% by 42% to n ormalise and you will get 2.46%. Or in other words the fact you saw him miss saw your belief he is a 50% shooter increase from 2% to2.46% while at the other end your belief he isa73% shooter dropped from 3% to 1.99% (3% prior by 27% liklihood of missing divided by 42% to normalise.)

    If you had seen him shoot 2 out of three the liklihood at each point would be s*s*f where s is the success rate and f is the failure rate(or 1-s)

    If you have enough data it doesnt matter how weird your starting prior is.

  27. #27
    illfuuptn
    illfuuptn's Avatar Become A Pro!
    Join Date: 03-17-10
    Posts: 1,860

    Quote Originally Posted by buby74 View Post
    Multiply your prior probability by the liklihood of the event happening then nor malise so that the sum equals 1. This is your posterior probability.

    So in your weird looking distribution to add the new data that you have observed a miss, first take the 50% true ability and mulltiply 2%(your prprior) by 50%(liklihood of missing if he is truely a 50% shooter) this gives 1% do this for every value in your weird distribution and then sum you will get 42% according to my spreadsheet so divide 1% by 42% to n ormalise and you will get 2.46%. Or in other words the fact you saw him miss saw your belief he is a 50% shooter increase from 2% to2.46% while at the other end your belief he isa73% shooter dropped from 3% to 1.99% (3% prior by 27% liklihood of missing divided by 42% to normalise.)

    If you had seen him shoot 2 out of three the liklihood at each point would be s*s*f where s is the success rate and f is the failure rate(or 1-s)

    If you have enough data it doesnt matter how weird your starting prior is.
    Thanks buby! Great response!

    Now...

    What happens if I want to do some sort of bayesian multiple non-linear regression to determine how Y(Shooting %) is affected by X's(distance from hoop, how well shooter is being defended, and dick size of shooter)?

    Sure, I could make a probability distribution for a shooter who is 15 feet from the hoop, is being defended at .78 on a scale of 0 to 1, and has an 8 inch dick. But a missed shot in the situation just described doesn't affect just the distribution of that exact situation. It should affect the distribution for 20 feet, .6, and 6.7 inches as well.

    How do I do that?

  28. #28
    buby74
    buby74's Avatar Become A Pro!
    Join Date: 06-08-10
    Posts: 92
    Betpoints: 21207

    Im going out on a limb here but I think the way to do it is to have many equations each with different weights for distance from hoop, being defended and size. With a prior degree of belief in which is the correct model. Then if you see a miss you work out the liklihood in each of your equations and then update your belief in each equation.So in prinicple it is the same but in practice it is very computationally intensive.

Top