 ## A few words about variance

Variance is a statistical quantity used to figure how spread out a given set of data points is relative to the mean average of the data points. The measure of the difference from the mean is called standard deviation, which is the square root of variance. Please see this link:
Variance and standard deviation

## Computing variance for blackjack using combinatorial analysis

In combinatorial analysis it is known that the sum of the probabilities of all possibilities must equal 1. In other words every possible outcome is accounted for. In blackjack there are 2 basic types of outcomes to consider relative to variance: simple and compound. A simple outcome means that the amount won or lost on the round is a single value, such as player hands played with a strategy of stand, double, or hit. There is also a chance of a tie on these hands. A compound outcome results from pair splitting or playing multiple hands simultaneously. Depending upon rules the outcome of a round where 3 splits are allowed can result in a gain or loss of 8 times original bet or anything in between. A tie means that an equal amount is won and lost. So, as with most problems in computing for blackjack, pair splitting is the big problem in computing variance. The case where doubling on any number of cards is a compound outcome but for a non-split hand it doesn't present the problems that pair splitting does in order to compute variance.

### Variance related to expected value

Consider these 2 games and probabilities of outcomes:
1. 99% probability of tie, 1% probability of win - expected value = +1%
2. 0% probability of tie, 50.5% probability of win, 49.5% probability of loss - expected value = +1%

expected value (ev) for both games = 1% = .01

The prerequisite to expect to win in the long run is a positive expected value and both games have the same EV, so in the long run will yield the same profit. However, they have differing variances. Obviously in game 1 there is no chance of ever being behind so the wager can be as large as possible without fear of losing. In game 2 there is the possibility of being behind and even maybe losing everything at some point. It turns out that simple variance is a function of the probability of a tie if EV is known for a (single) blackjack hand. Letting T = probability of a tie, it is easy to prove that:

variance for a stand/hit hand = 1 - T - EV^2
variance for a double down hand = 4*(1 - T) - EV^2

and similarly

variance(game 1) = 1 - .99 - (.01)^2 = .0099 units squared
standard deviation(game 1) = square root(.0099 units squared) = 0.0995 units

variance(game 2) = 1 - 0 - (.01)^2 = .9999 units squared
standard deviation(game 2) = square root(.9999 units squared) = 0.99995 units

Writing ev to include an indication liklihood of variation from the mean:
ev(game 1) = .01 ± 0.0995
ev(game 2) = .01 ± 0.99995

So if someone bet the farm on game 1, 99% of the time he would leave with exactly what he started with and 1% of the time leave with 2 farms. Betting the farm on game 2 means leaving farmless 49.5% of the time and leaving with 2 farms 50.5% of the time.

So is game 1 a better choice than game 2 or vice versa? They both have the same expected value but are distinguished by differing variances. In my opinion it could boil down to what you have to start with and what you are hoping to accomplish. Game 1 is a 100% risk free proposition but you may have to wait a long time before realizing any profit. If you don't have much to wager to begin with you could be waiting a long time for a small profit. Game 2 is much more of a gamble. In game 2 you have more of a chance of (luckily) realizing a pretty good profit fairly quickly but also have more of a chance of (unluckily) losing everything. In reality trying to profit from positive expected value is far removed from game 1 and much more like game 2.

Since I have no training in statistics I have tried to stick with observations that are basic. If there was an ongoing discussion by persons having more than just very basic knowledge of statistics, I would not have too much to contribute.

### Version of cdca that computes variance/standard deviation

I have incorporated what I have learned about variance/standard deviation into a version of cdca that computes these values. It is much slower than the original version due mainly to the way pair splitting is handled in order to compute variance. This version was updated 08-11-2012 to include output of standard deviation for overall calculations as well as individual player hands. Below is output for an overall calculation for a single deck. Computation takes about 22 minutes on my computer with 2 GB ram compared with about 1 second for the same calculation without a variance/standard deviation computation in the original version. This variance version can be downloaded from the software page.

```Rules:
bjOdds:  1.5
Dealer stands on soft 17
Double on any 2 cards
Lose only original bet to dealer blackjack (full peek)
No surrender versus up card of ace
No surrender versus up card of ten
No surrender allowed versus up cards 2 through 9
Maximum splits allowed for pairs 2 through 10:  1
Maximum splits allowed for a pair of aces:  1
No doubling after splitting is allowed
Hitting split aces is not allowed
Doubling after splitting aces is not allowed
No player hand is an automatic winner
Player may not double on more than 2 cards

Number of decks:  1
Compute mode:  Optimal
Computing overall EV ± STD DEV for input rules and removals

Press 0 if player's first card is unknown,
rank of card if known (t or T for 10):  0

Overall values given no knowledge of dealer's up card:  -0.0212742 ±1.1110990
Overall values given knowledge of dealer's up card:  0.0002479 ±1.1432251
values versus up card of 1:  -0.3602666 ±0.9547586
values versus up card of 2:  0.0999510 ±1.1857432
values versus up card of 3:  0.1358954 ±1.2041967
values versus up card of 4:  0.1819230 ±1.2601269
values versus up card of 5:  0.2335211 ±1.2720668
values versus up card of 6:  0.2394486 ±1.2837901
values versus up card of 7:  0.1453118 ±1.1019660
values versus up card of 8:  0.0544061 ±1.1036052
values versus up card of 9:  -0.0438279 ±1.1057332
values versus up card of 10:  -0.1707849 ±1.0329447

Press any key to continue
```