Aan de slagGa gratis aan de slag

Samples from multivariate normal distributions

The multivariate normal is the most important distribution in multivariate statistics. Here, you will learn to simulate data that follow a specified multivariate normal distribution by generating samples from a bivariate normal distribution, with a mean and variance-covariance matrix specified as:

$${\mu}={\begin{pmatrix} 2 \\ -2 \end{pmatrix}},\quad { \Sigma }={\begin{pmatrix} 9 & 5 \\ 5 & 4 \end{pmatrix}}$$

For this exercise, and the rest of the chapter, the mean and the variance-covariance matrix will be preloaded for you as mu.sim and sigma.sim.

Deze oefening maakt deel uit van de cursus

Multivariate Probability Distributions in R

Cursus bekijken

Oefeninstructies

  • Generate 100 samples from the bivariate normal distribution and assign them to the object multnorm.sample.
  • Print the first six samples.
  • Create a scatter plot of the generated samples.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Generate 100 bivariate normal samples
multnorm.sample <- ___

# View the first 6 samples
___

# Scatterplot of the bivariate samples 
plot(___)
Code bewerken en uitvoeren