docstr: Test for frontdoor estimation, from @AlxndrMlk
  See issue #616 https://github.com/py-why/dowhy/issues/616
code: def test_frontdoor_estimator(self):
      """
      Test for frontdoor estimation, from @AlxndrMlk
      See issue #616 https://github.com/py-why/dowhy/issues/616
      """
  
      # Create the graph describing the causal structure
      graph = """
          graph [
              directed 1
              
              node [
                  id "X" 
                  label "X"
              ]    
              node [
                  id "Z"
                  label "Z"
              ]
              node [
                  id "Y"
                  label "Y"
              ]
              node [
                  id "U"
                  label "U"
              ]
              
              edge [
                  source "X"
                  target "Z"
              ]
              
              edge [
                  source "Z"
                  target "Y"
              ]
              
              edge [
                  source "U"
                  target "Y"
              ]
              
              edge [
                  source "U"
                  target "X"
              ]
          ]
          """.replace(
          "\n", ""
      )
  
      N_SAMPLES = 10000
      # Generate the data
      U = np.random.randn(N_SAMPLES)
      X = np.random.randn(N_SAMPLES) + 0.3 * U
      Z = 0.7 * X + 0.3 * np.random.randn(N_SAMPLES)
      Y = 0.65 * Z + 0.2 * U
  
      # Data to df
      df = pd.DataFrame(np.vstack([X, Z, Y]).T, columns=["X", "Z", "Y"])
  
      # Create a model
      model = CausalModel(
          data=df, treatment="X", outcome="Y", graph=graph
      )
      estimand = model.identify_effect(proceed_when_unidentifiable=True)
      # Estimate the effect with front-door
      estimate = model.estimate_effect(
          identified_estimand=estimand,
          method_name="frontdoor.two_stage_regression",
      )
      assert estimate.value == pytest.approx(0.45, 0.025)
  
file_path: dowhy/tests/causal_estimators/test_two_stage_regression_estimator.py
imports: import numpy
  import pandas
  import pytest
  from pytest import mark
  from dowhy import CausalModel
  from dowhy.causal_estimators.two_stage_regression_estimator import TwoStageRegressionEstimator
  from .base import SimpleEstimator
label_desc: Use image node_id 2 for calling the TestTwoStageRegressionEstimator obj's underlying member method code with example usage: obj.test_frontdoor_estimator() without return types