This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
Generate 10 \(\mathcal{N}\sim (0,2)\) simulations. Recal the pdf of a normal distribution :
\[P(x) = \frac{1}{\sigma \sqrt {2\pi } }e^{ - ( {x - \mu })^2 / \sigma}\]
(x <- rnorm(10, 0, 2))## [1] 1.9220534 1.6299945 0.4803755 3.1518564 -2.4315120 1.3825424
## [7] 2.4251615 0.9489436 1.3091640 0.7609676
Plot the density
plot(density(x))Compute the median of x
median(x)## [1] 1.345853