code: def test_produce_nans_when_too_much_missing_data(
      self, seed, nans, nan_offset
  ):
      rand = np.random.RandomState(seed)
  
      betas = np.array([-0.5, 0.0, 0.5, 1.0, 1.5])
      independents = as_column(np.linspace(-5.0, 5.0, 30)) + np.arange(
          5
      )
      noise = as_column(rand.uniform(-2, 2, 30))
      dependents = 1.0 + betas * independents + noise
  
      # Write nans in a triangular pattern into the middle of the dependent
      # array.
      nan_grid = np.array(
          [
              [1, 1, 1, 1, 1],
              [0, 1, 1, 1, 1],
              [0, 0, 1, 1, 1],
              [0, 0, 0, 1, 1],
              [0, 0, 0, 0, 1],
          ],
          dtype=bool,
      )
  
      if nans == "dependent" or nans == "both":
          dependents[10 + nan_offset : 15 + nan_offset][
              nan_grid
          ] = np.nan
      if nans == "independent" or nans == "both":
          independents[10 + nan_offset : 15 + nan_offset][
              nan_grid
          ] = np.nan
  
      expected = self.naive_columnwise_pearson(dependents, independents)
      for allowed_missing in list(range(7)) + [10000]:
          results = vectorized_pearson_r(
              dependents, independents, allowed_missing
          )
          for i, result in enumerate(results):
              # column i has i + 1 missing values.
              if i + 1 > allowed_missing:
                  self.assertTrue(np.isnan(result))
              else:
                  assert_equal(result, expected[i])
  
imports: import numpy
  from numpy import arange, full, full_like, nan, where
  from pandas import DataFrame, date_range, Int64Index, Timestamp
  from pandas.util.testing import assert_frame_equal
  from scipy.stats import linregress, pearsonr, spearmanr
  from empyrical.stats import beta_aligned
  from zipline.assets import Equity, ExchangeInfo
  from zipline.errors import IncompatibleTerms, NonExistentAssetInTimeFrame
  from zipline.pipeline import CustomFactor, Pipeline
  from zipline.pipeline.data import USEquityPricing
  from zipline.pipeline.data.testing import TestingDataSet
  from zipline.pipeline.domain import US_EQUITIES
  from zipline.pipeline.engine import SimplePipelineEngine
  from zipline.pipeline.factors import Returns, RollingLinearRegressionOfReturns, RollingPearsonOfReturns, RollingSpearmanOfReturns, SimpleBeta
  from zipline.pipeline.factors.statistical import vectorized_beta, vectorized_pearson_r
  from zipline.pipeline.loaders.frame import DataFrameLoader
  from zipline.pipeline.sentinels import NotSpecified
  from zipline.testing import AssetID, AssetIDPlusDay, check_arrays, make_alternating_boolean_array, make_cascading_boolean_array, parameter_space
  import zipline.testing.fixtures
  from zipline.testing.predicates import assert_equal
  from zipline.utils.numpy_utils import as_column, bool_dtype, datetime64ns_dtype, float64_dtype
label_desc: Use image node_id 4 for calling the VectorizedCorrelationTestCase obj's underlying member method code with example usage: obj.test_produce_nans_when_too_much_missing_data(seed, nans, nan_offset) without return types