# ::Free Statistics and Forecasting Software::

v1.2.1

### :: Law of Averages - Free Statistics Software (Calculator) ::

All rights reserved. The non-commercial (academic) use of this software is free of charge. The only thing that is asked in return is to cite this software when results are used in publications.

The classic textbook by Freedman, Pisani and Purves called this version of the convergence of means the 'law of averages'. It was to dispel the myth that, for example, a large number of tosses of a fair coin would result in an equal number of heads and tails. It also shows that the symmetric random walk creates apparent trends much like stock market prices, even though using these trends for prediction would be folly since the expectation over the future is just the most recent value.

 Send output to: Browser Blue - Charts White Browser Black/White CSV Number of Tosses Probability Chart options Width: Height:

 Source code of R module n <- as.numeric(par1) p <- as.numeric(par2) heads=rbinom(n-1,1,p) a=2*(heads)-1 b=diffinv(a,xi=0) c=1:n pheads=(diffinv(heads,xi=.5))/c bitmap(file="test1.png") op=par(mfrow=c(2,1)) plot(c,b,type="n",main="Law of Averages",xlab="Toss Number",ylab="Excess of Heads",lwd=2,cex.lab=1.5,cex.main=2) lines(c,b,col="red") lines(c,rep(0,n),col="black") plot(c,pheads,type="n",xlab="Toss Number",ylab="Proportion of Heads",lwd=2,cex.lab=1.5) lines(c,pheads,col="blue") lines(c,rep(.5,n),col="black") par(op) dev.off()
 Top | Output | Charts | References

 Cite this software as: Weldon Larry, (2017), The Law of Averages (v1.0.3) in Free Statistics Software (v1.2.1), Office for Research Development and Education, URL https://www.wessa.net/rwasp_rwalk.wasp/ The R code is based on : Weldon Larry, Stat Ed Programs for Demos in R, Simon Fraser University, URL http://www.stat.sfu.ca/~weldon/title.doc Weldon Larry, R Programs for Statistics Education, Simon Fraser University, URL http://www.stat.sfu.ca/~weldon/Programs Weldon Larry, Instructions for using R programs for Statistics Education, Simon Fraser University, URL http://www.stat.sfu.ca/~weldon/instructions.doc
 Top | Output | Charts | References