fact.weight <- matrix(NA,nrow(dax.p),2)
fact.ret <- matrix(NA,nrow(dax.p),2)
fact.sd <- matrix(NA,nrow(dax.p),2)
fact.cov <- matrix(NA,ncol(fact.weight),ncol(fact.weight))
for (row in 15:nrow(fact.weight)) {
for (column in 1:ncol(fact.weight)) {
fact.ret[row,column] <- mean(fact.wealth.return[row-1:row,column])
fact.sd[row,column] <- sd(fact.wealth.return[row-1:row,column])
}
}
There is something wrong with my loop. fact.ret
and fact.sd
only returns NA
values. The problem may be here somewhere
mean(fact.wealth.return[row-1:row,column])
sd(fact.wealth.return[row-1:row,column])
But I can't see the problem myself. Do anyone see the problem?
Thank you in advance!