|
|
|
 | :: Sampling Distribution of the Sample Mean - 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.
Sampling Distribution of the Sample Mean: sdsm() and CLT.unif and CLT.exp. The very difficult concept of the sampling distribution of the sample mean is basic to statistics both for its importance for applications, and for its use as an example of modeling the variability of a statistic. sdsm() defaults uses a sample size of n=25 - it shows what a typical sample looks like relative to the density function (standard normal) and then shows a similarly-scaled diagram with the simulated sampling distribution of the sample mean. The emphasis is on the precision of averages, rather than the normality aspect.
The normality from the CLT is easier to understand than the precision-of-averages aspect, and so the latter is the focus here. One can use the program with different sample sizes: sdsm(ssize=10), sdsm(ssize=50), sdsm(ssize=100) can be tried here.
To make the point about the normality of the sdsm, use CLT.unif() or CLT.exp(), which use uniform(0,1) or exponential(1) as the population and show the sdsm as approximately normal. The default sample size is 10 but CLT.unif(25)
or CLT.exp(25) works for sample size 25 and any other sample size can also be used this way.
Click here to edit the underlying code of this R Module.Click here to edit the underlying code of this R Module.
| Source code of R module | | 1 | reps <- as.numeric(par1) | | 2 | ssize <- as.numeric(par2) | | 3 | m <- as.numeric(par3) | | 4 | s <- as.numeric(par4) | | 5 | samples <- FALSE | | 6 | my.dotplot.lims <- function (x, at=.44, cex=1, x.min=x.min, x.max=x.max ,scale=10, ...){ | | 7 | z=(x-mean(x))/sd(x) | | 8 | z=(round(scale*z)/scale) | | 9 | x=z*sd(x)+mean(x) | | 10 | edge=(x.max-x.min)/10 | | 11 | stripchart(x,method="stack", xlim=c(x.min-edge, x.max+edge), ylab="Frequency", at=at, cex=cex,...) | | 12 | } | | 13 | means=1:reps | | 14 | for (i in 1:reps) { | | 15 | sample=rnorm(ssize,m,s) | | 16 | mean=mean(sample) | | 17 | if (samples==T) { | | 18 | print(c("Sample Number",i)) | | 19 | print(format(sample,digits=1)) | | 20 | print (c("Mean of Sample Number",i,format(mean,digits=1)))} | | 21 | means[i]=mean | | 22 | } | | 23 | bitmap(file="test1.png") | | 24 | my.dotplot.lims(sample, x.min=m-2.5*s, x.max=m+2.5*s, scale=10/ssize^.5, main="typical sample vs population density", col="darkgreen", xlab="sample values") | | 25 | text(-2.2,1.5,"Sample Size =",col="darkgreen") | | 26 | text(-1,1.5,ssize) | | 27 | x=seq(m-2.5*s,m+2.5*s,length.out=25) | | 28 | lines(x,.4+dnorm(x,mean=m,sd=s),col="red",lwd=2) | | 29 | lines(x,x/x-.6,col="black") | | 30 | dev.off() | | 31 | bitmap(file="test2.png") | | 32 | my.dotplot.lims(means, x.min=m-2.5*s, x.max=m+2.5*s, scale=10/ssize^.5, main="Sampling Distribution of the Sample Mean", xlab="sample means",col="darkgreen") | | 33 | text(-2.2,1.5,"Sample Size =",col="darkgreen") | | 34 | text(-1,1.5,ssize) | | 35 | text(-3.0,1.35,reps) | | 36 | text(-1.8,1.35,"Sample Means",col="darkgreen") | | 37 | x=seq(m-2.5*s,m+2.5*s,length.out=25) | | 38 | lines(x,.4+dnorm(x,mean=m,sd=s),col="red",lwd=2) | | 39 | lines(x,x/x-.6,col="black") | | 40 | text(2,.8,"Population Density",col="red") | | 41 | dev.off() |
|
| Cite this software as: | | Weldon L., (2008), Sampling Distribution of the Sample Mean (v1.0.0) in Free Statistics Software (v1.1.23-r2), Office for Research Development and Education, URL http://www.wessa.net/rwasp_samplingdistributionmean.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 | | | | | | | | | |
|
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
|
|
|
|
|
|
|
|