Dear R gurus,
to compute the correlation matrix of "n" variables with "n_obs" observations
each,
possibly including NA, I use cor(M,  use="pairwise.obs")
where m is a "n" x "nobs" matrix.

Now I want to know the number of observations actually used in this
computation,
namely for each pair of columns in M, say pair (i,j),  I want to compute
sum( !is.na(M[,i])  &  !is.na(M[,j]) ).
I can think of several ways of constructing all pairs (i,j) with i<j, then
computing the sum
above, but for n=2000 and nobs=700 the computation time is prohibitive.

Is there an efficient way to solve this?

Many thanks,

jc

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to