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
.
This exercise is part of the course
Multivariate Probability Distributions in R
Exercise instructions
- 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.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Generate 100 bivariate normal samples
multnorm.sample <- ___
# View the first 6 samples
___
# Scatterplot of the bivariate samples
plot(___)