Question of the day

  • wolfkillj (1/25/2013)


    Sean Pearce (1/24/2013)


    I am getting myself confused with some simple maths :crazy:

    Answer 1

    Coalesce can take more than two parameters, and IsNULL takes exactly two parameters

    97%

    Answer 5

    Coalesce takes exactly two parameters, and IsNULL takes more than two parameters

    6%

    Does this mean somebody selected these two options as an answer?

    I think the percentage only indicates the percent of responses submitted with that answer checked. In a "select n answers" scenario, those figures don't tell us anything about how many people check the correct n answers or how many people checked each of the possible combinations of n answers. In the case of this question, the 5 choices yield 10 distinct combinations of 2 answers (n choose k = n!/(k!(n-k)!) = 10 for n = 5 and k = 2).

    I think you missed the arithmetic: if 97% of answers included option 1, then only 3% omitted it. So if more than 3% of answers included option 5, then some answers included both option 1 and option 5. Since these two options directly oontradict each other, the existence of such answers is rather surprising.

    Of course now the precentages have changed and we no longer have this surprise - it seems that people who answered after 06:15 GMT today were generally more capable of elementary logic than the early birds.

    Tom

  • Thanks for the straight forward question. A nice way to end the week!

  • L' Eomot Inversé (1/25/2013)


    wolfkillj (1/25/2013)


    Sean Pearce (1/24/2013)


    I am getting myself confused with some simple maths :crazy:

    Answer 1

    Coalesce can take more than two parameters, and IsNULL takes exactly two parameters

    97%

    Answer 5

    Coalesce takes exactly two parameters, and IsNULL takes more than two parameters

    6%

    Does this mean somebody selected these two options as an answer?

    I think the percentage only indicates the percent of responses submitted with that answer checked. In a "select n answers" scenario, those figures don't tell us anything about how many people check the correct n answers or how many people checked each of the possible combinations of n answers. In the case of this question, the 5 choices yield 10 distinct combinations of 2 answers (n choose k = n!/(k!(n-k)!) = 10 for n = 5 and k = 2).

    I think you missed the arithmetic: if 97% of answers included option 1, then only 3% omitted it. So if more than 3% of answers included option 5, then some answers included both option 1 and option 5. Since these two options directly oontradict each other, the existence of such answers is rather surprising.

    Of course now the precentages have changed and we no longer have this surprise - it seems that people who answered after 06:15 GMT today were generally more capable of elementary logic than the early birds.

    I hesitate to argue maths with one whose understanding of the topic dwarfs mine, so let's agree right off the bat that this is a discussion with the goal of learning and gaining understanding, OK, Tom?

    I think I can restate your assertion in general terms like this: "If the sum of the percentage of responses that included answer A and the percentage of responses that included answer B is equal to or greater than 100%, at least one response included both answer A and answer B." I have not come up with a scenario where this is not true, but I have not been able to derive a mathematical proof.

    However, the obverse does not hold true: "If at least one response included both answer A and answer B, the sum of the percentage of responses that include answer A and the percentage of responses that include answer B will be equal to or greater than 100%." This statement can be disproved by considering the case of a question with five possible answers, of which respondents must choose two. If 10 respondents each select one of the 10 possible k combinations of answers (5 choose 2), each answer will appear on 40% of the responses and the sum of the percentages of responses that include each pair will be 80% yet each pair will appear on one response.

    So the question is, "Can we determine the percentage of responses that included each pair of answers if we know only the percentage of responses that included each individual answer?" And if not, "What can we say with certainty about the set of responses if we know only the percentage of responses that included each individual answer?" I miss working at a post-secondary school where I could walk across the quad and find a professor in the math department to ask about problems like these. I think I'd need one who could enlighten me in combinatorics beyond the n choose k problem.

    I should know better than to use absolute language like "those figures don't tell us anything."

    Jason Wolfkill

  • Thanks for the easy Friday question. Lots of good comments and no complaining.

  • I am one of the guilty ones of always using ISNULL instead of COALESCE. It stems from habit. I've been using ISNULL for 10 years and only stumbled across COALESCE about 3 years ago. I have seen some instances where COALESCE makes more sense, but those are too few to make me change my default.

    Aigle de Guerre!

  • wolfkillj (1/25/2013)


    I hesitate to argue maths with one whose understanding of the topic dwarfs mine, so let's agree right off the bat that this is a discussion with the goal of learning and gaining understanding, OK, Tom?[/d 5quote]

    That seems pretty sensible.

    I think I can restate your assertion in general terms like this: "If the sum of the percentage of responses that included answer A and the percentage of responses that included answer B is equal to or greater than 100%, at least one response included both answer A and answer B." I have not come up with a scenario where this is not true, but I have not been able to derive a mathematical proof.

    No, not equal to or greater; only greater; and strictly speaking, in that form it's only true if exact percentages are used, not rounded percentages.

    For rounded percentages, the statement that can be made depends on the type of rounding. If "bankers' rounding" (round to even) is used, or halves are always rounded down, the statement is as above (with greater than). If halves are always rounded up, you have to substitute 101 for 100 (because if X is a whole number beteen 0 and 99 inclusive and the exact percentages are X+0.5 and 99.5-X, the exact percentages add up to 100 but the rounded percentages add up to 101). I don't know which sort of rounding the website uses, but the two numbers concerned did add to more than 101 (to 103, in fact) so someone had picked both those options.

    To prove the statement when exact percentages are used is easy: suppose option A has X% and option B has Y%, and the number of answers is N. Then the number of answers fincluding A is X*N/100 and the number of answers including B is Y*N/100.. Suppose no answer includes both A and B: then all these answers are different so options A and B represent (X+Y)*N/100 distinct answers. Since there are only N distinct answers altogether, X+Y can't be more than 100; so if X+Y is more than 100, the supposition that no answer includes both A and B leads to a contradiction, so at least one answer includes both A and B.

    To deal with rounding - well, if the rounded percentage is X the exact percentage is somewhere between X-0.5 and X+0.5, so it's possible that two rounded numbers add up to 1 more than the sum of the two exact numbers. If rounding is always downwards, that clearly can't happen. For bankers rounding, it isn't possible for two exact numbers to add up to 100 and the two numbers rounded to integers add up to 101 or more, because to have both round up they would both have to have a half as the fractional part, so the integer parts would add up to 99, so one of the integer parts would be even and the other odd so they would be rounded in opposite directions. Round to odd is the same as bankers' rounding for the question, with stochastic rounding you need the two to add up to more than 101 to be sure, with alternating rounding unless you know exactly what computation is done in what order you are stuck with needing 101 again.

    [quoote]

    However, the obverse does not hold true: "If at least one response included both answer A and answer B, the sum of the percentage of responses that include answer A and the percentage of responses that include answer B will be equal to or greater than 100%." This statement can be disproved by considering the case of a question with five possible answers, of which respondents must choose two. If 10 respondents each select one of the 10 possible k combinations of answers (5 choose 2), each answer will appear on 40% of the responses and the sum of the percentages of responses that include each pair will be 80% yet each pair will appear on one response.

    So the question is, "Can we determine the percentage of responses that included each pair of answers if we know only the percentage of responses that included each individual answer?"

    The answer in general is no, as you just proved with your example.

    And if not, "What can we say with certainty about the set of responses if we know only the percentage of responses that included each individual answer?" I miss working at a post-secondary school where I could walk across the quad and find a professor in the math department to ask about problems like these. I think I'd need one who could enlighten me in combinatorics beyond the n choose k problem.

    I wish I could answer that question. I know that sometimes we can make some deductions, but is probably a lot more to know. In the absence of a good prof, you might try one of Lancelot Hogbens books - he wrote a lot of maths texts for non-mathematicians; but borrow from a library and take a good look before buying, I've known people who love his books but I've also known people who hated them (I'm neutral) and learning from a book you hate is both unpleasant and difficult.

    I should know better than to use absolute language like "those figures don't tell us anything."

    We all say or write things like that from time to time. I'm lucky my mouth is large enough that my foot can fit into it without too much pain. 😀

    Tom

  • An easy one - thanks!

  • Great, easy question.

  • Thanks for the question.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 9 posts - 31 through 38 (of 38 total)

You must be logged in to reply to this topic. Login to reply