(self)
| 1356 | corrcoef(x, rowvar=False, bias=True)) |
| 1357 | |
| 1358 | def test_1d_with_missing(self): |
| 1359 | # Test corrcoef 1 1D variable w/missing values |
| 1360 | x = self.data |
| 1361 | x[-1] = masked |
| 1362 | x -= x.mean() |
| 1363 | nx = x.compressed() |
| 1364 | assert_almost_equal(np.corrcoef(nx), corrcoef(x)) |
| 1365 | assert_almost_equal(np.corrcoef(nx, rowvar=False), |
| 1366 | corrcoef(x, rowvar=False)) |
| 1367 | with suppress_warnings() as sup: |
| 1368 | sup.filter(DeprecationWarning, "bias and ddof have no effect") |
| 1369 | assert_almost_equal(np.corrcoef(nx, rowvar=False, bias=True), |
| 1370 | corrcoef(x, rowvar=False, bias=True)) |
| 1371 | try: |
| 1372 | corrcoef(x, allow_masked=False) |
| 1373 | except ValueError: |
| 1374 | pass |
| 1375 | # 2 1D variables w/ missing values |
| 1376 | nx = x[1:-1] |
| 1377 | assert_almost_equal(np.corrcoef(nx, nx[::-1]), corrcoef(x, x[::-1])) |
| 1378 | assert_almost_equal(np.corrcoef(nx, nx[::-1], rowvar=False), |
| 1379 | corrcoef(x, x[::-1], rowvar=False)) |
| 1380 | with suppress_warnings() as sup: |
| 1381 | sup.filter(DeprecationWarning, "bias and ddof have no effect") |
| 1382 | # ddof and bias have no or negligible effect on the function |
| 1383 | assert_almost_equal(np.corrcoef(nx, nx[::-1]), |
| 1384 | corrcoef(x, x[::-1], bias=1)) |
| 1385 | assert_almost_equal(np.corrcoef(nx, nx[::-1]), |
| 1386 | corrcoef(x, x[::-1], ddof=2)) |
| 1387 | |
| 1388 | def test_2d_with_missing(self): |
| 1389 | # Test corrcoef on 2D variable w/ missing value |
nothing calls this directly
no test coverage detected