mercredi 13 mai 2020

Create a matrix, covariance and correlation with Python

I'm a beginner and this seems fairly easy but for some reason I just can't seem to be able to do it, here's what I onto :

I have two random variables A and B : A = 12.5 , 6 , 7.4 , 9.8 , 4.7 , 6.7 , 16.7 , 14.1 , 1.7 , 8.2 B = 21.4 , 10.5 , 3.4 , 3.6 , 9.5 , 10.7 , 6.7 , 0.7 , 2.7 , 11.1 (the commas just separate the numbers).

From these variables I want to create : - variance covariance matrix - calculate the covariance between A and B - calculate the correlation between the column A and B - calculate 𝑟 ∗ 𝜎A 𝜎B , or 𝜎A 𝜎B that are respectively the standard deviations of A and B. - Create a new random variable x : 0.4 , 0.6 and calculate 𝑣𝑡A et √𝑣𝑡H𝑣

Could you help me out, I really want to know how to do :)

Thanks a lot !!




Aucun commentaire:

Enregistrer un commentaire