Multivariate normal sampling
In this exercise, you'll continue working with the house_price_size
DataFrame, which has been loaded for you. As a reminder, house_price_size
contains two columns called price
and size
representing the price and size of houses in that order.
Having explored the house_price_size
DataFrame, you suspect that this is a multivariate normal distribution because price
and size
each seem to follow a normal distribution. Based on the covariance matrix that you calculated in the previous exercise, you can now perform multivariate normal distribution sampling with a defined covariance structure!
To perform multivariate normal distribution sampling with defined covariance, you'll need the following information:
price
has a mean of 20 andsize
has a mean of 500price
has a variance of 19 andsize
has a variance of 50,000- The covariance for
price
andsize
is 950 - You'll sample 5,000 times
The following imports have been completed for you: seaborn
as sns
, pandas
as pd
, numpy
as np
, matplotlib.pyplot
as plt
, and scipy.stats
as st
.
This exercise is part of the course
Monte Carlo Simulations in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Assign the mean of price and size, sample size, and covariance matrix of price and size
mean_value = ____
cov_mat = np.array(____)
sample_size = ____