Hello all,

I am calculating the observed covariance matrix from the correlation matrix and the standard deviations. However, the resulting matrix apparently is not symmetric anymore (although judged by me it is...). Leading to the error message: The observed covariance matrix is not a symmetric matrix.

I hope somebody can help me out, thanks in advance!

Here is the code:

X = matrix(0,8,8)

val = c(1,.39,.35,.21,.32,.40,.39,.39,

1,.67,.11,.27,.29,.32,.29,1,.16,.29,

.28,.30,.37,1,.38,.30,.31,.42, 1,.47,

.42,.58,1,.41,.51,1,.42,1)

X[lower.tri(X, diag=TRUE)] = val

kaufcor = X + t(X) - diag(diag(X))

SD = matrix(0,8,8)

diag(SD) = c(3.40,2.40,2.90,2.70,2.70,4.20,2.80,3.00)

kaufcov = SD %*% kaufcor %*% SD

kaufcor==t(kaufcor)

kaufcov==t(kaufcov)