Reputation: 5155
So when using the R programming language, (which I'm very new to) I have a 4x2 matrix "gg" and when I do var(gg) it returns a 2x2 matrix as follows.
> gg <- matrix(c(4,2,4,5, 9, 14, 2, 32), nrow = 4, ncol = 2, byrow = TRUE)
> gg
[,1] [,2]
[1,] 4 2
[2,] 4 5
[3,] 9 14
[4,] 2 32
> var(gg)
[,1] [,2]
[1,] 8.916667 -11.25
[2,] -11.250000 182.25
now I understand that the 8.916 and the 182.25 are the variances of the first and second columns.
But what is the -11.5 ?
I have read that it could be a computed covariance or correlation? But a covariance cant be negative and a correlation must be between -1 and 1 so -11.5 satisfies neither of those two conditions. So I really don't understand what this -11.5 is representing?
Upvotes: 0
Views: 1012
Reputation: 9
var(gg)
where gg
is a matrix of columns x
and y
returns:
cov(xx), cov(xy)
cov(yx), cov(yy)
cov(xy) = cov(yx) because cov is defined as
E((x - xbar)(y - ybar)) = E((y - ybar)(x - xbar))
Upvotes: 1