Library: | xplore |
See also: | cov meanex varex |
Quantlet: | covex | |
Description: | an extended form of the cov function - NaN and all values contained in excl are excluded from computation |
Usage: | covx = covex(x{, excl}) | |
Input: | ||
x | d1 x d2 x .. x dn array, n <= 7 | |
excl | a matrix containing values to be excluded | |
Output: | ||
covx | d2 x d2 x d3 x .. dn array |
library("xplore") randomize(666) x = rint(10 * uniform(5, 4)) x[2,1] = NaN x excl = 2 covex(x,excl)
Contents of x [1,] 3 9 5 3 [2,] +NAN 4 2 6 [3,] 1 2 7 8 [4,] 9 5 5 1 [5,] 7 1 3 5 Contents of covx [1,] 13.333 -8 -4 -8 [2,] -8 10.917 4 -3.4167 [3,] -4 4 2.6667 2 [4,] -8 -3.4167 2 7.3