### Exercises/Play

- Find out the discrete uniform DU(K), (continuous) uniform (0,1), U(0,1) related R commands.
- 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 () and sample variance
- 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.

- 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?**

- Take K=400, 2000 and redo Exercise 2.
**What do you observe? Does this make sense to you?** - 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).
**R code**from class/history: g5class.r

### A prelude to ggplot2

- Data Visualization with ggplot2
- Cheatsheet (also available from your Rstudio help)
- ggplot2.org

Advertisements
(function(){var c=function(){var a=document.getElementById("crt-912181352");window.Criteo?(a.parentNode.style.setProperty("display","inline-block","important"),a.style.setProperty("display","block","important"),window.Criteo.DisplayAcceptableAdIfAdblocked({zoneid:388248,containerid:"crt-912181352",collapseContainerIfNotAdblocked:!0,callifnotadblocked:function(){a.style.setProperty("display","none","important");a.style.setProperty("visbility","hidden","important")}})):(a.style.setProperty("display","none","important"),a.style.setProperty("visibility","hidden","important"))};if(window.Criteo)c();else{if(!__ATA.criteo.script){var b=document.createElement("script");b.src="//static.criteo.net/js/ld/publishertag.js";b.onload=function(){for(var a=0;a<__ATA.criteo.cmd.length;a++){var b=__ATA.criteo.cmd[a];"function"===typeof b&&b()}};(document.head||document.getElementsByTagName("head")[0]).appendChild(b);__ATA.criteo.script=b}__ATA.criteo.cmd.push(c)}})();
(function(){var c=function(){var a=document.getElementById("crt-225946424");window.Criteo?(a.parentNode.style.setProperty("display","inline-block","important"),a.style.setProperty("display","block","important"),window.Criteo.DisplayAcceptableAdIfAdblocked({zoneid:837497,containerid:"crt-225946424",collapseContainerIfNotAdblocked:!0,callifnotadblocked:function(){a.style.setProperty("display","none","important");a.style.setProperty("visbility","hidden","important")}})):(a.style.setProperty("display","none","important"),a.style.setProperty("visibility","hidden","important"))};if(window.Criteo)c();else{if(!__ATA.criteo.script){var b=document.createElement("script");b.src="//static.criteo.net/js/ld/publishertag.js";b.onload=function(){for(var a=0;a<__ATA.criteo.cmd.length;a++){var b=__ATA.criteo.cmd[a];"function"===typeof b&&b()}};(document.head||document.getElementsByTagName("head")[0]).appendChild(b);__ATA.criteo.script=b}__ATA.criteo.cmd.push(c)}})();