# finding out distributions mathematically

we know that the larger the degree of freedom, the less likely extreme events will occur (e.g., if you throw fair coin once, odds of heads is 50%, if you throw twice, odds of two heads are 25% and so on). and if they indeed occurs, there becomes more reason to suspect there might be other factors at work as the sample size increases,

we can conduct a simple experiment to verify this by throwing a coin e.g., 10 times in a trial, we graph x-axis percentage of heads in each trial, y-axis frequency. the more trials you conduct, the more likely it will peak at the center where 0.5 is, and the total frequencies to its left will be very close to its right,

my question is, is there a rational way to calculate the distribution after any number of trials? e.g if i conduct the trail 70 times in the aforementioned experiment, what would the frequency be at each percentage of heads exactly?

• If a fair coin is tossed $n=70$ times, then the number $X$ of Heads has $X\sim\mathsf{Binom}(70,0.5).$ Thus $P(X \le 30) = P(X \ge 40) = 0.1410 ;$ from R where pbinom is a binomial CDF, we use the statement pbinom(30, 70, .5) which returns 0.1409895. – BruceET Jul 25 at 21:48
• but how does increasing the sample size help make it closer to that intuitive probability of a fair coin toss of 50%? (e.g., for a fair coin toss of 2 times, p<=1 = 0.75, 10 times, p<=5 is 62%, when 20 times, 58.8%) i can use the binomial function and understand its usage of combination factorials, i understand why it must be the case thematically, i just cannot understand the math behind it – robotart Jul 25 at 22:02
• in short, just what changes exactly mathematically when the sample size increases? again thematically i can understand, by increasing the sample size you are basically increasing precision, e.g., if you specify sample size 10000, then midpoint 5,000 will basically give you a chance of point probability of 0%, if sample size 10, midpoint 5 has probability of 24.6%, and i can write down and understand the combination factorial and find out the probability. i just cannot understand what changes in the math when i amp up the sample size. – robotart Jul 25 at 22:09
• Suppose you toss a coin $n=4$ times. Then the number of Heads is $X\sim\mathsf{Binom}(n=4,p=1/2),$ with $E(X) = np = 4/2 = 2,$ $V(X) = np(1-p) = 1,$ and $SD(X) = 1.$ If $\hat p = X/n,$ then $E(\hat p) = E(X/4) = 2/4 = 1/2,$ $V(\hat p) = V(X/4) = 1/16,$ and $SD(\hat p) = 1/4.$ Similarly, for $n = 64,$ $E(\hat p) = 1/2, V(\hat p) = 16/64^2 = 1/256,$ and $SD(\hat p) = 1/16.$ // Does that help answer your question on the effect of sample size? – BruceET Jul 25 at 23:18
• thanks for your clarification BruceET..i don't 100% understand how V(x/n) are calculated..but i examined the data i have simulated in a spreadsheet, larger sample size does lower the standard deviation, but i feel this is more akin to saying that the curve is more flattened than bulging in the center. – robotart Jul 26 at 0:10

As BruceET writes, the standard way to model this is the binomial distribution. (I believe he is misunderstanding you, though.)

Specifically, each trial consists of throwing a fair coin 10 times and recording the number of heads. (Note that the binomial distribution is usually used for counts, not percentages, but you can of course easily convert back and forth.) This is described by taking a draw from a binomially distributed random variable with parameters $$n=10$$ and $$p=0.5$$. The probability of seeing $$0, 1, \dots, 10$$ heads can be calculated - see the Wikipedia article or R:

> dbinom(0:10,10,0.5)
[1] 0.0009765625 0.0097656250 0.0439453125 0.1171875000 0.2050781250
[6] 0.2460937500 0.2050781250 0.1171875000 0.0439453125 0.0097656250
[11] 0.0009765625


If you do this 70 times, then you just drew 70 binomial samples. You can simulate drawing these 70 samples as follows:

set.seed(1) # for reproducibility
foo <- rbinom(70,10,0.5)


Here is a histogram of this sample, with the red line showing the expected counts:

hist(foo,breaks=seq(-0.5,10.5),col="grey")
lines(0:10,70*dbinom(0:10,10,0.5),type="o",pch=19,col="red")


If you increase the number of samples beyond 70, the histogram will get closer to the expected counts. (And if you increase the number of coin tosses in each trial beyond 10, the histogram will look more and more like a normal distribution.)

• thank you for your answer! but what changes exactly mathematically when you increase the sample size? apologies for the ambiguity of my original question. – robotart Jul 25 at 22:16
• (+1) for this. // To clarify, my Comment was intended as a clue, not an answer. – BruceET Jul 26 at 0:33

To illustrate the convergence in a sequence of coin tosses to approximately equal numbers of Heads and Tails, one sometimes looks at the excess $$D_n$$ of the number of Heads over the number of tails. If the number of heads by the $$n$$th toss is $$X_n \sim \mathsf{Binom}(n, p),$$ then $$D_n = X_n - (n - X_n) = 2X_n- n.$$

Then the Law of Large Numbers guarantees the convergence of $$A_n = D_n/n$$ to $$0$$ with increasing $$n.$$ A plot of the 'running averages' $$A_n$$ against $$n$$ is sometimes called a 'trace' of the coin toss experiment.

Four traces are shown in the figure below. Typically, at the left side of such a plot, for small $$n,$$ the values of $$A_n$$ will be quite variable, but for larger $$n,$$ towards the right, the values 'settle down' near to $$0.$$

Here is R code used to make the figure.

set.seed(1234); M = 1000
par(mfrow=c(2,2))
for(i in 1:4) {
ht = sample(c(-1,1), M, rep=T)  # +1 = Head, -1 = Tail.
a = cumsum(ht)/(1:M)
plot(a, type="l", lwd=2, ylab="Running Avg")
abline(h=0, col="green2")
}
par(mfrow=c(1,1))