(self)
| 1354 | cov(x, rowvar=False, bias=True)) |
| 1355 | |
| 1356 | def test_1d_with_missing(self): |
| 1357 | # Test cov 1 1D variable w/missing values |
| 1358 | x = self._create_data() |
| 1359 | x[-1] = masked |
| 1360 | x -= x.mean() |
| 1361 | nx = x.compressed() |
| 1362 | assert_almost_equal(np.cov(nx), cov(x)) |
| 1363 | assert_almost_equal(np.cov(nx, rowvar=False), cov(x, rowvar=False)) |
| 1364 | assert_almost_equal(np.cov(nx, rowvar=False, bias=True), |
| 1365 | cov(x, rowvar=False, bias=True)) |
| 1366 | # |
| 1367 | try: |
| 1368 | cov(x, allow_masked=False) |
| 1369 | except ValueError: |
| 1370 | pass |
| 1371 | # |
| 1372 | # 2 1D variables w/ missing values |
| 1373 | nx = x[1:-1] |
| 1374 | assert_almost_equal(np.cov(nx, nx[::-1]), cov(x, x[::-1])) |
| 1375 | assert_almost_equal(np.cov(nx, nx[::-1], rowvar=False), |
| 1376 | cov(x, x[::-1], rowvar=False)) |
| 1377 | assert_almost_equal(np.cov(nx, nx[::-1], rowvar=False, bias=True), |
| 1378 | cov(x, x[::-1], rowvar=False, bias=True)) |
| 1379 | |
| 1380 | def test_2d_with_missing(self): |
| 1381 | # Test cov on 2D variable w/ missing value |
nothing calls this directly
no test coverage detected