Question: Please don't use the build-in function in Numpy, please use python language. Problem 3 Suppose that X is a matrix with n rows and m

Please don't use the build-in function in Numpy, please use python language.
Problem 3 Suppose that X is a matrix with n rows and m columns. In statistics, these matrices arise fregently when we collect (numerical) data on m variables which are each observed on n independent individuals. Suppose we denote the columns of X = (x1, ..., xm). Then the covariance matrix of X is defined as Var(x1) Cov(x1, x2) Cou(x1, xm) Cou(x2,x) Var(x2) Cou(x2, xm) Cov(X) = : : Cov(xm, xi) Cov(xm, x2) Var(xm) where Var(x;) is the sample variance of the entries in the ith column of X and Cov(x, x;) (i = j) is the sample covariance of the entries in columns i and j. 1 Cou(xi, x;) = (xki - x)(Xkj - x;) n-1 k=1 That is, the covariance matrix is a square m X m matrix whose diagonal entries are the sample variances of the columns of X and whose off-diagonal entries are covariances between two columns of X, respectively. Write your own function that takes a Numpy array of shape (n.m) as its input and returns the Covariance matrix of the array. Do not use any built-in functions to compute variance and/or covariance. Write your own functions, instead. It's ok to use Numpy routines for sums, squares, or square-roots. Check your work by comparing your result to that of the np.cov() function applied to the same input. Problem 3 Suppose that X is a matrix with n rows and m columns. In statistics, these matrices arise fregently when we collect (numerical) data on m variables which are each observed on n independent individuals. Suppose we denote the columns of X = (x1, ..., xm). Then the covariance matrix of X is defined as Var(x1) Cov(x1, x2) Cou(x1, xm) Cou(x2,x) Var(x2) Cou(x2, xm) Cov(X) = : : Cov(xm, xi) Cov(xm, x2) Var(xm) where Var(x;) is the sample variance of the entries in the ith column of X and Cov(x, x;) (i = j) is the sample covariance of the entries in columns i and j. 1 Cou(xi, x;) = (xki - x)(Xkj - x;) n-1 k=1 That is, the covariance matrix is a square m X m matrix whose diagonal entries are the sample variances of the columns of X and whose off-diagonal entries are covariances between two columns of X, respectively. Write your own function that takes a Numpy array of shape (n.m) as its input and returns the Covariance matrix of the array. Do not use any built-in functions to compute variance and/or covariance. Write your own functions, instead. It's ok to use Numpy routines for sums, squares, or square-roots. Check your work by comparing your result to that of the np.cov() function applied to the same input
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
