I'm trying to multiply some matrices and the following error occurs:
B <- 2*mcov
B <- cbind(B,c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1))
B <- cbind(B,t(mrend))
B <- rbind(B, c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0))
B <- rbind(B, ((1 + c(meanNovartis, meanRDS, meanRoche, meanEJ, meanHSBC,
meanBayer, meanUnilever, meanGSK, meanSanofi, meanAnheuser,
meanSiemens, meanLoreal, meanInnate,
meanBT,meanNestle,0,0)^12)-1))
B
c <- matrix(c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,(((1+mean(meanRDS))^12))-1),
nrow=17, ncol=1)
And when trying to solve:
x <- solve(B)%*%c
This error appears:
Error in solve.default(B) : Lapack routine dgesv: system is exactly singular: U[17,17] = 0