Game 5: Models: Sampling from a distribution/population (Continuous r.v.)

Exercises/Play

  1. Find out the discrete uniform DU(K), (continuous) uniform (0,1), U(0,1) related R commands.
  2. Prepare a 2×2 window for the following graphs of X, a discrete uniform (10) random variable.
    • Plot pmf. cdf of X
    • Plot a histogram of 10 sample from X. Compute the sample mean (\bar{x}) and sample variance s^2 = \frac{1}{10-1}\sum_{i=1}^{10}(x_i - \bar{x})^2
    • Plot a histogram of 100 sample. Compute the sample mean and sample variance.
    • Plot a histogram of 1000 sample. Compute the sample mean and sample variance.
  3. Keep the plotted window, open another window and redo the steps in 2. Compare the results. What do you observe? Does this make sense to you?
  4. Take K=400, 2000 and redo Exercise 2. What do you observe? Does this make sense to you?
  5. Take the random variable X to be U(0,1), redo exercise 2 (except for the first dot, you will be plotting a pdf instead of a pmf of X).
  6. R code from class/history: g5class.r

A prelude to ggplot2

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s