search for: cvm1_list

Displaying 1 result from an estimated 1 matches for "cvm1_list".

Did you mean: cmd_list
2011 Sep 30
1
Covariance-Variance Matrix and For Loops
Hello, I am very new to R (as my Subject probably indicates). I want to do something that should, I think, be very simple. I have five vectors in a list and I want to construct a covariance matrix out of them. Given a 5X5 matrix cvm1, and the list of vectors, cvm1_list, I thought the following would work (sorry cannot find code tags): for(i in 1:5){ for(j in 1:5){ cvm1[i,j] <- cov(cvm1_list[[i]], cvm1_list[[j]]) } } (PS. I know this is not the var-cov matrix yet but I though it might be a start.) But I get the error: Error in cov(cvm1_list[[i]], cvm1...