class_docstr: Compute effect of treatment using some regression function.
  
  Fits a regression model for estimating the outcome using treatment(s) and
  confounders.
  
  Base class for all regression models, inherited by
  LinearRegressionEstimator and GeneralizedLinearModelEstimator.
class_docstr_tok: ["Compute","effect","of","treatment","using","some","regression","function",".","Fits","a","regression","model","for","estimating","the","outcome","using","treatment","(","s",")","and","confounders",".","Base","class","for","all","regression","models",",","inherited","by","LinearRegressionEstimator","and","GeneralizedLinearModelEstimator","."]
docstr: Fits the estimator with data for effect estimation
  :param data: data frame containing the data
  :param treatment: name of the treatment variable
  :param outcome: name of the outcome variable
  :param effect_modifiers: Variables on which to compute separate
              effects, or return a heterogeneous effect function. Not all
              methods support this currently.
docstr_tok: ["Fits","the","estimator","with","data","for","effect","estimation",":","param","data",":","data","frame","containing","the","data",":","param","treatment",":","name","of","the","treatment","variable",":","param","outcome",":","name","of","the","outcome","variable",":","param","effect_modifiers",":","Variables","on","which","to","compute","separate","effects",",","or","return","a","heterogeneous","effect","function",".","Not","all","methods","support","this","currently","."]
code: def fit(
      self,
      data: pd.DataFrame,
      effect_modifier_names: Optional[List[str]] = None,
  ):
      """
      Fits the estimator with data for effect estimation
      :param data: data frame containing the data
      :param treatment: name of the treatment variable
      :param outcome: name of the outcome variable
      :param effect_modifiers: Variables on which to compute separate
                  effects, or return a heterogeneous effect function. Not all
                  methods support this currently.
      """
      self.reset_encoders()  # Forget any existing encoders
      self._set_effect_modifiers(data, effect_modifier_names)
  
      self.logger.debug(
          "Back-door variables used:"
          + ",".join(self._target_estimand.get_backdoor_variables())
      )
      self._observed_common_causes_names = (
          self._target_estimand.get_backdoor_variables()
      )
      if len(self._observed_common_causes_names) > 0:
          self._observed_common_causes = data[
              self._observed_common_causes_names
          ]
          self._observed_common_causes = self._encode(
              self._observed_common_causes, "observed_common_causes"
          )
      else:
          self._observed_common_causes = None
  
      self.symbolic_estimator = self.construct_symbolic_estimator(
          self._target_estimand
      )
      self.logger.info(self.symbolic_estimator)
  
      # The model is always built on the entire data
      _, self.model = self._build_model(data)
      coefficients = self.model.params[
          1:
      ]  # first coefficient is the intercept
      self.logger.debug(
          "Coefficients of the fitted model: "
          + ",".join(map(str, coefficients))
      )
      self.logger.debug(self.model.summary())
  
      return self
  
file_path: dowhy/dowhy/causal_estimators/regression_estimator.py
imports: from typing import Any, List, Optional, Union
  import numpy
  import pandas
  import statsmodels.api
  from dowhy.causal_estimator import CausalEstimate, CausalEstimator, IdentifiedEstimand
  from dowhy.utils.encoding import one_hot_encode
label_desc: Use image node_id 4 for calling the RegressionEstimator obj's underlying member method code with example usage: obj.fit(data, effect_modifier_names) and returns: self