I have to compute the inverse of the covariance matrix [variance covariance covariance variance] between 2 assets (SPY and TLT) over the time horizon 2006 2010 I did this
ret1=diff(SPY1) %2006-31/12/2009 of log of SPY
ret2=diff(TLT1)
dim(ret1)
dim(ret2)
dim(m1)
dim(r1)
m1 = t(m1)
r1 = t(r1)
inv_C = matrix(0,nrow = NCOL(ret1),ncol = 1)
for(i in 1:NCOL(ret1)) {
cov1 = cov(ret1[,i],ret2[,i])
inv_C[i,] = 1/cov1
}
but this give me only a single value for each I need all the matrix HOW can I do that? Thanks