::Free Statistics and Forecasting Software::

v1.1.23-r2
 
  Black&White | Blue Theme | Normal Fontsize | Increase Fontsize | Decrease Fontsize | Toggle underline
Secure website (SSL) | Private
 
 


This software module is powered by R

:: 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.

Click here to edit the underlying code of this R Module.

Number of Tosses 
Probability 
Chart options
Width:
Height:

Click here to edit the underlying code of this R Module.





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



Cite this software as:
Weldon Larry, (2008), The Law of Averages (v1.0.2) in Free Statistics Software (v1.1.23-r2), Office for Research Development and Education, URL http://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 | History | Feedback
Delete history
Server DateModuleCommand
Wed, 20 Aug 2008 01:13:28 -0600Start of session-
Top | Output | Charts | References | History | Feedback

Please, send us your feedback!
Overall rating
What do you think about the response time?
Rate the facility with which you interact with our software.
Is the output presented in an understandable (clear) form?
How did you find this website/module?
Do you have any comments or suggestions for our site?
Please enter the code that is displayed in this picture: captcha

To cite Wessa.net in publications use:
Wessa, P. (2008), Free Statistics Software, Office for Research Development and Education,
version 1.1.23-r2, URL http://www.wessa.net/

© Resa R&D, and the 'Office for Research, Development, and Education' - All rights reserved. Academic license for non-commercial use only.
This website is an intellectual and physical property of Resa R&D. This includes: html content, graphical illustrations (gif files), computer software, online or electronic documentation, associated media, and printed materials. The free use of the scientific content, services, and applications in this website is granted for non commercial use only. In any case, the source (url) should always be clearly displayed. Under no circumstances are you allowed to reproduce, copy or redistribute the design, layout, or any content of this website (for commercial use) including any materials contained herein without the express written permission of Resa R&D or the Office for Research, Development, and Education.

Information provided on this web site is provided "AS IS" without warranty of any kind, either express or implied, including, without limitation, warranties of merchantability, fitness for a particular purpose, and noninfringement. We use reasonable efforts to include accurate and timely information and periodically update the information, and software without notice. However, Resa R&D makes no warranties or representations as to the accuracy or completeness of such information (or software), and it assumes no liability or responsibility for errors or omissions in the content of this web site, or any software bugs in online applications. Your use of this web site is AT YOUR OWN RISK. Under no circumstances and under no legal theory shall Resa R&D be liable to you or any other person for any direct, indirect, special, incidental, exemplary, or consequential damages arising from your access to, or use of, this web site.

Software Version : 1.1.23-r2
Algorithms & Software : Prof. dr. P. Wessa
Facilities : Resa R&D - Office for Research, Development, and Education
Server : www.wessa.net

Comments, Feedback & Errors | Privacy Policy | Statistics Resources | Wessa.net Home

 © Wessa.Net 2002-2008  
 
 

Home Page
Equation Plotter
Time Series Analysis (new)
Time Series Analysis (old)
Multiple Regression (new)
Multiple Regression (old)
Descriptive Statistics
Statistical Distributions
Hypothesis Testing
Statistics Education

Academic citations
Computations Archive
Search Computations
R Project
FAQ
About Wessa.net
Powered by Linux

Server status page
History list
Edit R Code
Google
Web wessa.net