Description Usage Arguments Details Value See Also Examples
View source: R/mean_vs_median_normal_movie.R
A movie to compare the sampling distributions of the sample mean and sample median based on a random sample of size n from a standard normal distribution.
1 2 | mean_vs_median_normal_movie(n = 10, delta_n = 1, pos = 1,
envir = as.environment(pos))
|
n |
An integer scalar. The size of the samples drawn from a standard normal distribution. |
delta_n |
A numeric scalar. The amount by which the value of the sample size is increased/decreased after one click of the +/- button. |
pos |
A numeric integer. Used in calls to |
envir |
An alternative way (to |
The movie is based on simulating repeatedly samples of size
n
from a standard normal N(0,1) distribution. It contains
three plots. The top plot contains a histogram of the most recently
simulated dataset, with the N(0,1) probability density function (p.d.f.)
superimposed.
Each time a sample is simulated the sample mean and sample median are calculated. These values are indicated on the top plot as a filled circle: a red circle for the sample mean and a blue circle for the sample median; and are added to the values plotted in the middle and bottom plots.
The plot in the middle contains a histogram of the sample means of all the simulated samples. The p.d.f.s of the sampling distributions of the sample mean (thick red line) and the sample medians (thin blue line) are superimposed.
The plot on the bottom contains a histogram of the sample medians of all the simulated samples. The p.d.f.s of the sampling distributions of the sample mean (thin red line) and the sample medians (thick blue line) are superimposed.
An extra sample is produced by clicking the + button next to "number of samples of size n". [Ignore the - button.] The value of the sample size can be changed using the +/- buttons in the panel.
Nothing is returned, only the animation is produced.
movies
: general information about the movies.
mean_vs_median_t_movie
: compares the
sampling distributions of the sample mean and sample median based
on a random sample of size n from a Student's t distribution.
1 2 3 4 5 6 7 8 9 | # Load package rpanel
# [Use install.packages("rpanel") if necessary]
library(rpanel)
# Produce movie using values from the Aussie births data
## Not run:
mean_vs_median_normal_movie()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.