Hi all,
I have a matrix that has many NaN values. As soon as one of the columns has
a missing (NaN) value the covariance estimation gets thrown off.
Is there a robust way to do this?
Thanks,
Sachin
a=array(rnorm(9),dim=c(3,3))> a [,1] [,2] [,3]
[1,] -0.79418236 0.7813952 0.855881
[2,] -1.65347906 -1.9462446 -0.376325
[3,] -0.03144987 0.6756862 -1.879801> a[3,2]=NANError: object 'NAN'
not found> a[3,2]=NaN> a [,1] [,2] [,3]
[1,] -0.79418236 0.7813952 0.855881
[2,] -1.65347906 -1.9462446 -0.376325
[3,] -0.03144987 NaN -1.879801> cov(a) [,1] [,2] [,3]
[1,] 0.6585217 NA -0.5777408
[2,] NA NA NA
[3,] -0.5777408 NA 1.8771214
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.