# Estimate the mean vector and the covariance matrix using the simple returns

I would appreciate help with how to to estimate the mean vector and the covariance matrix using the simple returns in R.

I have historical (weekly) values of five stocks from a capital market for a period that covers ten years. And I have used the price data to determine the simple returns on each of these five stocks. Now I want to estimate the mean vector and the covariance matrix using these simple returns.

However, I cannot find any information on how to use the simple returns to do this and neither do I understand that if it should be one mean vector for all five stocks or five different mean vectors - is it someone that want to help me clarify and understand this?

My initial thoughts: If we, for example, take the stock BAC (Bank of America Corporation) we can find the mean by mean(BAC.sr) where BAC.sr is the simple returns of the stock. This gives me the result 0.001083249 but I don't feel like this is the right way since mean(BAC.sr) give us the mean of the simple returns of BAC and I don't think this is what the mean vector is.

The mean vector is the the vector of the individual means of the stocks. See example in R with two simple vectors below. Here I used colMeans to get the mean vector, and cov to get the covariance.

x <- c(2, 4, 6, 20)
y <- c(2, 3, 6, 9)
mat <- cbind(x,y)
mat
x y
[1,]  2 2
[2,]  4 3
[3,]  6 6
[4,] 20 9

colMeans(mat)
x y
8 5

cov(x,y)
 24