Page 1 of 2 12 LastLast
Results 1 to 13 of 23

Thread: Standard Deviation Calculation

  1. #1


    Did you find this post helpful? Yes | No

    Standard Deviation Calculation

    This is yet another post about "why don't my by-hand calculations match CVCX output." I have read many of them and done my do diligence but still want to understand the underlying math.

    I am using the formula from Blackjack Attack 3 on page 20-21 to calculate per hand standard deviation, but it does not match when I use simulations for multiple hands. According to BJA3

    SD = TC_FREQ * TC_BET^2 * TC_SPOTS * (TC_SD^2 * TC_SPOTS + 0.5 * TC_SPOTS * (TC_SPOTS - 1))

    ... for each simulated true count, where TC_* is the simulation/entered value for that given true count.

    But when I run the numbers, I get different results. Am I missing something?

  2. #2


    Did you find this post helpful? Yes | No
    The formula you quote as being for the SD is for the Variance, which is the square of the SD. In addition, the multiplication sign (*) after the first term in the parentheses should be an addition sign.

    Don't be sloppy!

    Don

  3. #3


    Did you find this post helpful? Yes | No
    Don, thanks for the quick response! Also, BJA3 is a great reference; I have learned so much, and have so much more to learn!

    You are correct, I was a little sloppy. I meant to use the following formula:

    TC_PROD = TC_FREQ * TC_BET^2 * TC_SPOTS * (TC_SD^2 * TC_SPOTS + 0.5 * TC_SPOTS * (TC_SPOTS - 1))

    and

    SD = SQRT( SUM(TC_PROD) / SUM(TC_FREQ) )

    This is the exact formula provided in BJA3. You took a step further and normalized the SD when <1.0 of the frequency is known/provided/used.

    However, I am a little confused by your comment about switching a "*" to a "+" since this formula matches the exact output for CVCX when simulating a single hand. Also, I double checked BJA3 pg. 20 and it should be multiplication unless I misunderstood the footnote. If I switch to a "+" instead, I end up with a number that is ~33% different than CVCX output (for that particular simulation), instead of an exact match.

    However, that formula does not match CVCX output for playing multiple hands. Every simulation I have tested against ends up with different multi-hand SD than CVCX output. For example, one of the simulations reported the SD at 42% below the value calculated by BJA3's formula above.

    I know that concrete examples can help bring concepts to life so here is an online spread sheet that provides example calculations for (1) BJA3 pg. 20, (2) CVCX single hand simulation, and (3) CVCX two hand simulation.

    https://docs.google.com/spreadsheets...it?usp=sharing

    Thanks again for the help and guidance!

  4. #4


    Did you find this post helpful? Yes | No
    You have an extra E25 in your formulas, which was what I was trying to point out, in terms of factoring out that term and having just a + sign instead of doing an extra multiplication by the number of hands (in this case, two).

    As a result, the two numbers you're comparing, that are "off" by 42%, are, in fact, off by a factor of sqrt(2) = 1.414.

    In essence, you have four E25 in your formula, when there should be only three (corresponding to the h's in my page 20 footnote, of which there are only three).

    Don

  5. #5


    Did you find this post helpful? Yes | No
    Great! That does get a little closer, but I am still seeing 13% error. I think my confusion was related to the format of the table and foot note formula

    The values and derivations of the "Bet Squared", "Hands", "Frequency", and "Product" columns are clear. But I am stumbling with the formula for "Var - (h-1)* Cov". If I take the BJA3 examples and derive the TC_SD using:

    TC_"Var + (h-1)* Cov" = (one-hand variance) + 0.5 * (h - 1)
    TC_"Var + (h-1)* Cov" - 0.5 * (h - 1) = (one-hand variance)
    (one-hand variance) = TC_"Var + (h-1)* Cov" - 0.5 * (h - 1)
    (one-hand standard deviation) = SQRT( TC_"Var + (h-1)* Cov" - 0.5 * (h - 1) )


    The numbers look believable based on TC_SD output by CVCX. This leads me to believe that you suggesting to remove an "h", I actually need to remove a "factor of h" from the foot note formula since it is included in the "Hands" column. That provides the following formula:

    TC_PROD = TC_FREQ * TC_BET^2 * TC_SPOTS * (TC_SD^2 + 0.5 * (TC_SPOTS - 1))

    Does that seem reasonable? While it doesn't (intuitively) match the BJA3 pg 20 formulas, it does match CVCX outputs.

    Also, I want to make sure that we don't need a further addition of TC_SD^2 + (1 / TC_SPOTS) * (TC_SPOTS - 1) for playing 3+ hands, instead of always multiplying by 1/2

    -----

    Also, sorry for diving down to this level of detail; I am just trying not to be sloppy

  6. #6


    Did you find this post helpful? Yes | No
    Quote Originally Posted by de314 View Post
    Great! That does get a little closer, but I am still seeing 13% error.
    How are you seeing an error, when the discrepancy I pointed out is precisely off by sqrt(2)? Remove one of the number of hands multipliers, and it matches CVCX exactly. What's the problem?

    Quote Originally Posted by de314 View Post
    But I am stumbling with the formula for "Var - (h-1)* Cov".
    The first minus sign should be a + sign. STOP BEING SLOPPY!

    Quote Originally Posted by de314 View Post
    TC_"Var + (h-1)* Cov" = (one-hand variance) + 0.5 * (h - 1)
    TC_"Var + (h-1)* Cov" - 0.5 * (h - 1) = (one-hand variance)
    (one-hand variance) = TC_"Var + (h-1)* Cov" - 0.5 * (h - 1)
    (one-hand standard deviation) = SQRT( TC_"Var + (h-1)* Cov" - 0.5 * (h - 1) )
    Why do you have to make the terminology so incredibly complicated? I gave it in the footnote. Why do you need all this gibberish above? Why do you have TCs all over the place?

    Quote Originally Posted by de314 View Post
    The numbers look believable based on TC_SD output by CVCX. This leads me to believe that you suggesting to remove an "h", I actually need to remove a "factor of h" from the foot note formula since it is included in the "Hands" column. That provides the following formula:
    The h IS the number of hands. You multiply by the number of hands ONE SINGLE TIME. Do you not see that the h can be factored out? In essence, it's:
    SD = sqrt {freq. * bet squared *h[Var. + (h-1)*Cov.]}, which looks like your formula,
    TC_PROD = TC_FREQ * TC_BET^2 * TC_SPOTS * (TC_SD^2 + 0.5 * (TC_SPOTS - 1))

    Quote Originally Posted by de314 View Post
    Does that seem reasonable? While it doesn't (intuitively) match the BJA3 pg 20 formulas, it does match CVCX outputs.
    It exactly matches the BJA3 formula! Why are you not seeing that?? The book and CVCX give exactly the same results. You showed it yourself, in your spreadsheet, if you'd get rid of one of the B25s in the third example, which doesn't belong there. (It doesn't belong in the second example, either, but because it's always one hand, there's no harm done by multiplying by 1 one too many times. But you can't do that when the number of hands is a two!)

    Quote Originally Posted by de314 View Post
    Also, I want to make sure that we don't need a further addition of TC_SD^2 + (1 / TC_SPOTS) * (TC_SPOTS - 1) for playing 3+ hands, instead of always multiplying by 1/2
    You're really trying to mess this up, aren't you? The 0.5 doesn't change no matter how many hands there are. See Griffin, bottom of page 142. It's the same formula!!

    Stop overthinking this and just plug in the numbers correctly.

    Don

  7. #7


    Did you find this post helpful? Yes | No
    Quote Originally Posted by de314 View Post
    Also, I want to make sure that we don't need a further addition of TC_SD^2 + (1 / TC_SPOTS) * (TC_SPOTS - 1) for playing 3+ hands, instead of always multiplying by 1/2
    There are a couple of potential sources of confusion/error here. One is that you are correct that the formula in Table 2.1 is only correct for 2 hands, not for 3 or more. The other is that, although the *conditional* variance for each individual true count may be calculated as discussed here, the *overall* variance is not just the weighted sum of these variances as suggested in Table 2.1. The overall variance requires some additional cross terms, so to speak, and thus is greater than just that weighted sum. (It's perhaps a question for Norm whether CVCX is indeed computing overall variance, or just second moment; if the former, that may be one potential cause of the discrepancy you're seeing.)

    E

  8. #8


    Did you find this post helpful? Yes | No
    Quote Originally Posted by ericfarmer View Post
    There are a couple of potential sources of confusion/error here. One is that you are correct that the formula in Table 2.1 is only correct for 2 hands, not for 3 or more.
    The footnote for page 20 was changed to match Griffin's general formula, page 142. The formula is not just for two hands; it's for any number of hands. Or else, Griffin is wrong.

    Quote Originally Posted by ericfarmer View Post
    The other is that, although the *conditional* variance for each individual true count may be calculated as discussed here, the *overall* variance is not just the weighted sum of these variances as suggested in Table 2.1. The overall variance requires some additional cross terms, so to speak, and thus is greater than just that weighted sum. (It's perhaps a question for Norm whether CVCX is indeed computing overall variance, or just second moment; if the former, that may be one potential cause of the discrepancy you're seeing.)
    Norm can answer, but it's virtually certain that Norm is not calculating it differently than I did.

    Don

  9. #9
    Random number herder Norm's Avatar
    Join Date
    Dec 2011
    Location
    The mote in God's eye
    Posts
    12,461
    Blog Entries
    59


    Did you find this post helpful? Yes | No
    CVCX only sims single hand play. It uses an estimation technique to extrapolate to two-hand play. CVData is required for accurate multi-hand play. In multi-hand sims, CVData calculates actual, overall variance for the round. It does not apply a co-variance conversion.
    "I don't think outside the box; I think of what I can do with the box." - Henri Matisse

  10. #10


    Did you find this post helpful? Yes | No
    Quote Originally Posted by DSchles View Post
    The footnote for page 20 was changed to match Griffin's general formula, page 142. The formula is not just for two hands; it's for any number of hands. Or else, Griffin is wrong.
    Huh. In my copy of BJA3 (ISBN 0-910575-20-7), the footnote on p.20 reads only, "* Note: h = number of simultaneous hands played." The header for the fifth (of six) columns is labeled "Var+(h-1)*Cov."

    Quote Originally Posted by DSchles View Post
    Norm can answer, but it's virtually certain that Norm is not calculating it differently than I did.

    Don
    Interesting. Then it's worth noting for Norm that CVCX is also computing overall variance in the same incorrect way as described in the book (although the individual variances conditioned on true count, which seem to be the focus of OP's confusion, are correct).

  11. #11


    Did you find this post helpful? Yes | No
    Quote Originally Posted by ericfarmer View Post
    Huh. In my copy of BJA3 (ISBN 0-910575-20-7), the footnote on p.20 reads only, "* Note: h = number of simultaneous hands played." The header for the fifth (of six) columns is labeled "Var+(h-1)*Cov."
    As I wrote, the book was reprinted last year, and that footnote was changed to correspond precisely to Griffin's page 142 formula, on which you haven't commented.

    Quote Originally Posted by ericfarmer View Post
    Interesting. Then it's worth noting for Norm that CVCX is also computing overall variance in the same incorrect way as described in the book (although the individual variances conditioned on true count, which seem to be the focus of OP's confusion, are correct).
    I can remember Michael Canjar's once writing something to the effect that third and fourth moments (skew and kurtosis) were virtually nonexistent for blackjack, so I'm wondering if the effect you're commenting on is just of theoretical interest or if it has any practical importance.

    Don

  12. #12


    Did you find this post helpful? Yes | No
    I looked through some old (1983) Blackjack Newsletters of Stanford Wong, in which he ran multiple simulations for playing two hands of blackjack. He generated, line by line, variances and covariances but didn't give overall results. It's interesting to note that both terms have minimums at true counts around -2 or -3 and that, in both directions from there, the terms both increase. As a result, only the variance and covariance at around -2 are about 1.31 and 0.500, respectively. They are larger at the extremes. If CVData uses the actual line-by-line covariances instead of a one-size-fits-all 0.50, that could account for some difference, as well.

    But the OP's differences from what he is attributing to CVCX are entirely explained by an extra factor of 2 in his formula, as the ratio between the spreadsheet result and the CVCX result is precisely sqrt(2).

    Don

  13. #13


    Did you find this post helpful? Yes | No
    Quote Originally Posted by DSchles View Post
    As I wrote, the book was reprinted last year, and that footnote was changed to correspond precisely to Griffin's page 142 formula, on which you haven't commented.
    Sorry, I did gloss over the reference to Griffin's formula, which is indeed correct-- at least in form. That is, the 0.50 covariance seems to be dragged along as a "constant" into current calculations, when it isn't clear to me that this is justified (and from your follow-on comment about Wong's data, it probably isn't).

    Quote Originally Posted by DSchles View Post
    I can remember Michael Canjar's once writing something to the effect that third and fourth moments (skew and kurtosis) were virtually nonexistent for blackjack, so I'm wondering if the effect you're commenting on is just of theoretical interest or if it has any practical importance.

    Don
    This is a good point; the difference depends on how the variance is being used. As we've discussed in past email exchange, if it's being used, for example, to compute SCOREs, win rates, etc., then it's definitely of practical importance, causing a difference of roughly 6-7% errors in win rate for the 6D study from a couple of years ago.

    What is interesting is that, unfortunately, the error in the table (and apparently thus in CVCX) is not easy to correct without more detailed data. That is, we really need the *distributions* of outcomes in each true count bin, not just the EVs and variances, to correctly compute the overall variance.

    E

Page 1 of 2 12 LastLast

Similar Threads

  1. CVCX Standard Deviation Calculation
    By MercySakesAlive in forum Software
    Replies: 4
    Last Post: 05-10-2018, 07:45 PM
  2. CVCX Standard Deviation Calculation
    By MercySakesAlive in forum Software
    Replies: 14
    Last Post: 01-18-2017, 11:20 PM
  3. MJ: Standard Deviation
    By MJ in forum Blackjack Main
    Replies: 29
    Last Post: 03-09-2005, 03:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

About Blackjack: The Forum

BJTF is an advantage player site based on the principles of comity. That is, civil and considerate behavior for the mutual benefit of all involved. The goal of advantage play is the legal extraction of funds from gaming establishments by gaining a mathematic advantage and developing the skills required to use that advantage. To maximize our success, it is important to understand that we are all on the same side. Personal conflicts simply get in the way of our goals.