Question

Covariance matrix I want to make a covariance matrix with the following variables: AGG, VAW, IWN,...

Covariance matrix

I want to make a covariance matrix with the following variables: AGG, VAW, IWN, SPY, EWG and EWW.

I found the covariance of the variables in r with this code:

cov(wr[ ,c("AGG","VAW","IWN","SPY","EWG","EWW")])

Here's the result:

              AGG           VAW           IWN           SPY
AGG  3.571068e-05 -4.260068e-05 -2.587826e-05 -3.239567e-05
VAW -4.260068e-05  1.301973e-03  9.838237e-04  7.927169e-04
IWN -2.587826e-05  9.838237e-04  1.024990e-03  7.221941e-04
SPY -3.239567e-05  7.927169e-04  7.221941e-04  6.143463e-04
EWG -5.084499e-05  1.109888e-03  9.502014e-04  8.046398e-04
EWW -3.710732e-05  1.184849e-03  1.010141e-03  8.152602e-04
              EWG           EWW
AGG -5.084499e-05 -3.710732e-05
VAW  1.109888e-03  1.184849e-03
IWN  9.502014e-04  1.010141e-03
SPY  8.046398e-04  8.152602e-04
EWG  1.444157e-03  1.179610e-03
EWW  1.179610e-03  1.659257e-03

How do I make a covariance matrix of the result?

Thanks in advance.

Homework Answers

Answer #1

No need to worry the computed matrix is itself a covariance matrix but the output is slightly confusing as the variables are not in need order. I have typed the output in a simple manner so you can understand. The highlighted part are the variables corresponding to that are the values of the variance and covariance. Hope this helps.

AGG VAW IWN SPY EWG   EWW
AGG 3.571068e-05 -4.260068e-05 -2.587826e-05 -3.239567e-05 -5.084499e-05 -3.710732e-05
VAW -4.260068e-05 1.301973e-03 9.838237e-04 7.927169e-04 1.109888e-03 1.184849e-03
IWN -2.587826e-05 9.838237e-04 1.024990e-03 7.221941e-04 9.502014e-04 1.010141e-03
SPY -3.239567e-05 7.927169e-04 7.221941e-04 6.143463e-04 8.046398e-04 8.152602e-04
EWG -5.084499e-05 1.109888e-03 9.502014e-04 8.046398e-04 1.444157e-03 1.179610e-03
EWW -3.710732e-05 1.184849e-03 1.010141e-03 8.152602e-04 1.179610e-03 1.659257e-03

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
The following code must be written in Matlab I want to print the following in Matlab...
The following code must be written in Matlab I want to print the following in Matlab (x1,x2, x3, ....xn) = (0.33333, 0.33333, 0.33333,....) That is for n variables . The whole thing should be on the same line. I need to use fprintf and write out the coordinates with 5 decimal places of variable xn = (0.33333, 0.33333, 0.33333,....) Thanks!
1. Given a matrix variable "mat", write code using for loops, if statements, etc. that will...
1. Given a matrix variable "mat", write code using for loops, if statements, etc. that will accomplish the same as the following: matsum = sum(mat') Please make sure to store the result in "matsum" and dont use sum. This is what I have so far but it keeps telling me is wrong.... % mat has been initialized for you: mat = randi([-100,100],randi([15,20]),randi([15,20])); % write your statements that accomplish the code above: [r c]=size(mat); for i=1:c matsum=0; for j=1:r matsum=matsum+mat(j,i); end...
I don't want explanation , I just want a correct answer, Very quickly. 06- Based on...
I don't want explanation , I just want a correct answer, Very quickly. 06- Based on the GDP deflator, inflation is positive (relative to the base year) if Select one: a. nominal GDP is larger than real GDP b. can't be detrmined from the given information c. nominal GDP equals real GDP d. nominal GDP is less than real GDP e. All of the above 05- Based on price setting behavior, we know that an increase in the markup will...
I'm using Rstudio and i am not very familiar using it. I am not sure how...
I'm using Rstudio and i am not very familiar using it. I am not sure how i am suppose to code this to place it in the chunk to get results. Let's think of calendar year 2016 as a sample of all the days in olywthr. First create a dataframe, cal2016, containing only days in 2016 from the larger dataframe olywthr (I have supplied the R code to do this in the following chunk). Run str() and summary() on the...
I want my results to show only once, but it keeps repeating the last result adding...
I want my results to show only once, but it keeps repeating the last result adding to new result making a pyramid. How do i fix this please! so for example when i run the code i want it to be like this: [(12.44, 4.18), (9.57, 3.03), (3.14, 0.46), (13.46, 4.58)], etc, etc NOT LIKE THIS: [(12.44, 4.18)] [(12.44, 4.18), (9.57, 3.03)] [(12.44, 4.18), (9.57, 3.03), (3.14, 0.46)] [(12.44, 4.18), (9.57, 3.03), (3.14, 0.46), (13.46, 4.58)] def choco_and_nobel(minimum_, maximum_):     ...
3) Which of the following statements is TRUE about multiple regression? I. We do not want...
3) Which of the following statements is TRUE about multiple regression? I. We do not want our explanatory variables to be interrelated. II. At least one slope should be statistically significant. III. The slopes should not change if one variable is removed. A) I only B) II only C) I and II only D) I and III only 4) A regression model is built using the heights and body fat percentages to predict the weights of 30 volunteers. How many...
DESCRIPTION: You will be given a 2D array, called matrix, of Strings. The array has an...
DESCRIPTION: You will be given a 2D array, called matrix, of Strings. The array has an unknown number of cells filled with data. Your goal is to iterate through the 2D array and keep a count of how many cells are full. You will be given the dimensions of the array. INPUT: All input has been handled for you: Two integers denoting the dimensions of the array. These are the integer variables rows and cols. A partially filled 2-D array....
How do I make this code not include negative numbers in the total or average if...
How do I make this code not include negative numbers in the total or average if they are entered? (C++) For example, if you enter 4, 2, and -2, the average should not factor in the -2 and would be equal to 3. I want the code to factor in positive numbers only. ----- #include using namespace std; int main() {    int x, total = 0, count = 0;       cout << "Type in first value ";   ...
Hello! I am coding in c# and I am having trouble using boolean variables and if...
Hello! I am coding in c# and I am having trouble using boolean variables and if statements. The project I am working on is based on the users input, and the code should branch into two different options. However, I am struggling to understand how to take the users input to decide which path to take. Another problem I am having is with my if statements. After the user has inputed information and the code decides to take them down...
1.1 Suppose you want to make a scale model of a hydrogen atom. You choose, for...
1.1 Suppose you want to make a scale model of a hydrogen atom. You choose, for the nucleus, a small ball bearing with a radius of [01] mm. The radius of the hydrogen atom is 0.529 × 10−10 m and the radius of the nucleus is 1.2 × 10−15 m. (a) What would be the radius (m) of the model? (b) Suppose that now you want to make a scale model of the solar system using the same ball bearing...