195 points · by sebg · 3y ago · 75 comments
The number of samples you need is very difficult to calculate correctly, requiring deep analysis of standard deviations and variances.
But surprisingly, you can simply know you've reached large number status when over 10 items exist in each category.
---------
Ex: when doing a heads vs tails coin flip experiment, you likely have a large number once you have over 10 heads and over 10 tails. No matter how biased the coin is.
Or in this 'Lotto ticket' example, you have a large number of samples after gathering enough data to find over 10 Jackpot winners.
I think you can justify it by approximating each category as an independent Poisson distribution. Then for each such processes the variance equals the mean. So once you have 10 successes in a bin, you have evidence of a probably good estimate for the arrival rate of that category. The book "The Probabilistic Method" calls a related idea "the Poisson paradigm."
(10 a nice round number where the standard deviation is below the mean)
Am I mistaken?
You gotta draw the line somewhere. At high-school statistics level, its basically universally drawn at the 95% confidence level. If you wanna draw new lines elsewhere, you gotta make new rules yourself and recalculate all the rules of thumb.
[1] For example as described by Feynman in Cargo Cult Science.
I am kind of wondering if a semantic highlighting makes sense as well. You often end up with some implicit assignment of lowercase latin, uppercase latin, lowercase greek letters and such for certain meanings. Kinematic - xyzt for position in time, T_i(I_i) for the quaternion or transformation representing a certain joint of a robot.
It takes a little bit of work to colour in equations but I hope more people start doing it (including me, I'd forgotten about it for a while)
But there's already such complex and varied typography in math I wonder if it would be kind of redundant. E.g. you don't need matching parentheses to be colored when they already come in different sets of matching heights.
In reality, it depends on your actual distribution, but the OP from this thread here is unreasonably conservative for something described as a "rule of thumb". Almost always, if you have at least 10 of every category, you can already discover every interesting thing that a rule of thumb will allow. And you probably could go with less. But if you want precision, you can't get it with rules of thumb.
What I'm asking about, I know I'm wrong about - I just want to know how I can derive that for myself.
That skips over the distinction between "average" and "probability distribution", but those are nuances are probably better left for a proof of the central limit theorem.
The Law of Large Numbers is about the average, so it's not relevant here (an average of +1 would mean you got heads every single time, which is extremely unlikely for large n).
If you are looking at the sum, then the value depends on whether the number of trials (n) is even or odd. If n is odd, you would indeed get two peaks at 1 and -1, and you would never get exactly 0. If n is even, you would get a peak at 0 and you would never get exactly 1 or -1.
The expected value (aka average) is a number, not a distribution. The expected value for the sum is 0 even when n is odd and you can't get exactly 0 -- that's just how the expected value works (in the same way that the "expected value" for the number of children in a family can be 2.5 even though a family can't have half a child). If you look at the probability density function for a single trial, then it does have two peaks at 1 and -1 (and is zero everywhere else).
The curve you refer to might be the normal approximation (https://en.wikipedia.org/wiki/Binomial_distribution#Normal_a...). It's true that the normal approximation for the distribution of the sum in your gambling game has a peak at 0 even when n is odd and the sum can't be exactly 0. That's because the normal approximation is a continuous approximation and it doesn't capture the discrete nature of the underlying distribution.
However to answer your question more directly, the expected value is just another name for the average or mean of a random variable. In this case, the variable is your profit. Assume we’re betting a dollar per toss on coin flips and I win if it’s heads (everyone knows heads always wins, right?). The expected value is probability of heads * 1 - probability of tails * 1. If the coin is fair, the probabilities are the same so the expected value is zero.
Aside: sequences of random variables that are “fair bets” are called martingales and are incredibly useful. It’s a fair bet because, given all prior knowledge of the value of the variable thus far, the expected value of the next value you witness is the current value of the variable. You could imagine looking at a history of stock values. Given all that information, it’s a martingale (and thus a fair bet) if given that information your expected profit from investing is 0.
See this https://stats.stackexchange.com/questions/416204/why-is-a-mi...
> Always keep the speed of convergence in mind when applying the law of large numbers.
Any ‘application’ of the LLN basically amounts to replacing some probalistic number derived from a bunch of random samples with the expected value of that number… and tacking on ‘for sufficiently large n’ as a caveat to your subsequent conclusions.
Figuring out whether, in practical cases, you will have a sufficiently large n that the conclusion is valid is a necessary step in the analysis.
The econometrics textbook I studied has more words “asymptotic” in it than there are pages. Oftentimes it’s impractical or even theoretically intractable to derive finite sample properties (and thus to answer when n is really large enough).
This is "as close" in an absolute sense, right?
If I take into account that the lottery value is 20x larger, and I'm targeting relative accuracy, then I need 2.5 million times as many samples?
- Your odds calculation is likely wrong. You assumed from the word "odds" that "odds ratio" was meant, (Odds=3 meaning "odds 3:1 against" corresponding to p=25%) but the phrase is "approximate odds 1 in X" (Odds=3 meaning "odds of 1 in 3 to win" meaning 33%) and recalculating results in the remarkably exact expected value of $80 which seems intentional?
- You phrase things in terms of variances, people will think more in terms of standard deviations. So 3.5 ± 1.7 vs $80 ± $12,526.
- Note that you try to make a direct comparison between those two but the two are in fact incomparable. The most direct comparison might be to subtract 1 from the die roll and multiply by $32, so that you have a 1/6 chance of winning $0, 1/6 of winning $32, ... 1/6 of winning $160. So then we have $80 ± $55 vs $80 ± $12,526. Then instead of saying you'd need 50 million more lottery tickets you'd actually say you need about 50 thousand more. This is closer to the "right ballpark" where you can tell that the whole lottery is expected to sell about 10,200,000 tickets on a good day.
- But where an article like this should really go is, "what are you using the numbers for?". In the case of the Texas lottery this is actually a strong constraint, they have to make sure that they make a "profit" (like, it's not a real profit, it probably goes to schools or something) on most lotteries, so you're actually trying to ensure that 5 sigma or so is less than the bias. So you've got a competition between $20 · n and 5 · $12,526 · √(n), or √(n) = 12526/4, n = 9.8 million. So that's what the Texas Lottery is targeting, right? So then we would calculate that the equivalent number of people that should play in the "roll a die linear lottery" we've constructed is 187, call it an even 200, if 200 people pay $100 for a lottery ticket on the linear lottery then we can pretty much always pay out even on a really bad day.
- So the 50,000x number that is actually correct is basically just saying that we can run a much smaller lottery, 50,000 times smaller, with that payoff structure. And there's something nice about phrasing it this way.
- To really get "law of large numbers" we should actually probably be looking at how much these distributions deviate from Gaussian, rather than complaining that the Gaussian is too wide? You can account for a wide Gaussian in a number of ways. But probably we want to take the cube root of the 3d cumulant, for example, try to argue when it "vanishes"? Except given the symmetry the 3rd cumulant for the die is probably 0 so you might need to go out to the 4th cumulant for the die -- and this might give a better explanation for the die converging more rapidly in "shape" to the mean, it doesn't just come close faster, it also becomes a Gaussian significantly faster because the payoff structure is symmetric about the mean.
(No, just joking. Actually 42 plus or minus.)