Dear all,
I have a list of correlation coefficient matrixes. Each matrix represents one
date.
For example
A[[1]]
A B C
A 1 0.2 0.3
B 0.2 1 0.4
C 0.3 0.4 1
A[[2]]
A B C
A 1 0.5 0.6
B 0.5 1 0.7
C 0.6 0.7 1
....
A[[n]]
I would like to calculate the mean of correlation coefficient from the whole
time series, i.e.
Average cor(A,B) = (A[[1]][2,1] + A[[2]] [2,1] + ... + A[[n]] [2,1])/n
Average cor(A,C) = (A[[1]][3,1] + A[[2]] [3,1] + ... + A[[n]] [3,1])/n
Average cor(B,C) = (A[[1]][3,2] + A[[2]] [3,2] + ... + A[[n]] [3,2])/n
Please note that some cells are NA; so I need to remove them when calculating
average.
How could I get this efficiently? Thank you
Best Regards,
Suphajak Ngamlak
Equity and Derivatives Trading
Phatra Securities Public Company Limited
Tel: (66)2-305-9179
Email: [email protected]
[[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.