Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# Calculate the Covariance for discrete random variables # Input X and Y are in a table with corresponding probabilities value_x = np.array([1, 2,

image

# Calculate the Covariance for discrete random variables # Input X and Y are in a table with corresponding probabilities value_x = np.array([1, 2, 3]) value y = np.array([1, 2, 3, 4]) # Covariance matrix # the first dimension is for varaiable x # the second dimension is for varaiable y prob_matrix = np.array([[0.12, 0.08, 0.07, 0.05], [0.08, 0.15, 0.21, 0.13], [0.01, 0.01, 0.02, 0.07]]) # Expectation of x exp_x = print("Expectation of x: ", exp_x) # Expectation of y exp_y = print("Expectation of y: ", exp_y) # Variance of x var_x = print("Variance of x: ", var_x) # Variance of y var y = print("Variance of y: ", var_y) # Covariance cov = _print("Covariance: ", cov)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Econometrics

Authors: James H. Stock, Mark W. Watson

3rd edition

133595420, 978-0138009007, 138009007, 978-0133486872, 133486877, 978-0133595420

More Books

Students also viewed these Algorithms questions