Hi, I have a column vector in which the first T elements belong to the first simulation, the next T elements belong to the second simulation and so on so it is of length T*simulations. I want to find the covariance between the data at t and t+2, for example, if it was a = [1,2,3,4,5,1,2,3,4,5,1,2,3,4,5] for 3 simulations and 5 periods then I would get b = [3,4,5,missing,missing,3,4,5,missing,missing,3,4,5,missing,missing] and I would get the cov(a,b). I was wondering if anyone knows a quick way to do this? I think I might be best to use dataframes but I am not familiar with that and so I was wondering if any of you have come across this and can offer a solution?
Thanks, Jude