@@ -179,7 +179,7 @@ Use R functions to generate random values drawn from the Uniform and Gaussian di
...
@@ -179,7 +179,7 @@ Use R functions to generate random values drawn from the Uniform and Gaussian di
**Hint:**
**Hint:**
```{r eval=FALSE}
```{r eval=FALSE}
# Uniform U[1, 10]
# Uniform U[0, 10]
obs <- runif(n = 100, min = 0, max = 10)
obs <- runif(n = 100, min = 0, max = 10)
# Gaussian N(3, 4)
# Gaussian N(3, 4)
obs <- rnorm(n = 100, mean = 3, sd = 4)
obs <- rnorm(n = 100, mean = 3, sd = 4)
...
@@ -201,7 +201,7 @@ mean(obs)
...
@@ -201,7 +201,7 @@ mean(obs)
var(obs)
var(obs)
```
```
- Gaussian $\NN(3, 4)$: mean $= 3$ and variance $= 4$
- Gaussian $\NN(3, 4)$: mean $= 3$ and standard-deviation $= 4$
```{r}
```{r}
# random data
# random data
...
@@ -250,10 +250,10 @@ Because of the variability due to the randomness of the sampling.
...
@@ -250,10 +250,10 @@ Because of the variability due to the randomness of the sampling.
<div class="pencadre">
<div class="pencadre">
We generate multiple random samples of size 100 following the same $\UU[1,10]$ uniform distribution and we compute the empirical mean for each sample. What do you see?
We generate multiple random samples of size 100 following the same $\UU[0,10]$ uniform distribution and we compute the empirical mean for each sample. What do you see?
```{r}
```{r}
mean_estim <- replicate(1000, mean(runif(n = 100, min = 1, max = 10)))
mean_estim <- replicate(1000, mean(runif(n = 100, min = 0, max = 10)))