It would be very handy if, when type="cov", mxData could intelligently take lower, upper and full covariance matrices. Because a matrix or dataframe will be provided, the difference between the types is that one or other triangle will be full of 0s or NAs.
i.e., that this would work:
data = read.moments(file = "", diag = T)
1
.3 1
.4 .35 1
mxData(data, type="cov",numObs=100)
without first requiring
data[upper.tri(data)] = data[lower.tri(data)]
I guess the code would check for symmetry, then reflect the non-zero triangle into the empty triangle using lower.tri(), upper.tri() and t()
Ideally, detecting that the diagonal is missing would cause it to be filled with 1s.
#1
Log in or register to post comments
#2
should this not throw an error?
library(sem)
data = read.moments(file = "", diag = T)
1
.3 1
.4 .35 1
mxData(data, type="cov",numObs=100)
# I'd expect something like "covariance matrices must be symmetrical"
Log in or register to post comments
#3
Log in or register to post comments