class_docstr: A wrapper class that uses IV2SLS from statsmodel
  
  A linear 2SLS model that estimates the average treatment effect with endogenous treatment variable.
docstr: Fits the 2SLS model.
  
  Args:
      X (np.matrix or np.array or pd.Dataframe): a feature matrix
      treatment (np.array or pd.Series): a treatment vector
      y (np.array or pd.Series): an outcome vector
      w (np.array or pd.Series): an instrument vector
docstr_tok: ["Fits","the","2SLS","model",".","Args",":","X","(","np.matrix","or","np.array","or","pd.Dataframe",")",":","a","feature","matrix","treatment","(","np.array","or","pd.Series",")",":","a","treatment","vector","y","(","np.array","or","pd.Series",")",":","an","outcome","vector","w","(","np.array","or","pd.Series",")",":","an","instrument","vector"]
code: def fit(self, X, treatment, y, w):
      """Fits the 2SLS model.
  
      Args:
          X (np.matrix or np.array or pd.Dataframe): a feature matrix
          treatment (np.array or pd.Series): a treatment vector
          y (np.array or pd.Series): an outcome vector
          w (np.array or pd.Series): an instrument vector
      """
  
      X, treatment, y, w = convert_pd_to_np(X, treatment, y, w)
  
      exog = sm.add_constant(np.c_[X, treatment])
      endog = y
      instrument = sm.add_constant(np.c_[X, w])
  
      self.iv_model = IV2SLS(
          endog=endog, exog=exog, instrument=instrument
      )
      self.iv_fit = self.iv_model.fit()
  
file_path: causalml/causalml/inference/iv/iv_regression.py
imports: import numpy
  from causalml.inference.meta.utils import convert_pd_to_np
  import statsmodels.api
  from statsmodels.sandbox.regression.gmm import IV2SLS
label_desc: Use image node_id 2 for calling the IVRegressor obj's underlying member method code with example usage: obj.fit(X, treatment, y, w) without return types