1 Bayesian Inference

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:

Exercise 1

Statement

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}\]

Solutions

(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

Exercise 2

Statement

Plot the density

Solutions

plot(density(x))

1.1 …….

2 Monte - Carlo

Exercise 7

Statement

Compute the median of x

Solutions

median(x)
## [1] 1.345853