code: def test_given_linear_data_when_estimate_intrinsic_causal_influence_with_variance_then_returns_expected_results():
      causal_model = StructuralCausalModel(
          nx.DiGraph([("X0", "X1"), ("X1", "X2"), ("X2", "X3")])
      )
  
      X0 = np.random.normal(0, 1, 5000)
      X1 = X0 + np.random.normal(0, 0.001, 5000)
      X2 = X1 + np.random.normal(0, 2, 5000)
      X3 = X2 + np.random.normal(0, 1, 5000)
      training_data = pd.DataFrame(
          {"X0": X0, "X1": X1, "X2": X2, "X3": X3}
      )
      auto.assign_causal_mechanisms(causal_model, training_data)
  
      fit(causal_model, training_data)
  
      iccs = intrinsic_causal_influence(
          causal_model,
          "X3",
          prediction_model="approx",
          num_samples_baseline=2000,
      )
      assert iccs["X0"] == approx(1, abs=0.3)
      assert iccs["X1"] == approx(0, abs=0.05)
      assert iccs["X2"] == approx(4, abs=0.5)
      assert iccs["X3"] == approx(1, abs=0.25)
      assert np.sum([iccs[key] for key in iccs]) == approx(
          estimate_variance(X3), abs=0.5
      )
  
      iccs = intrinsic_causal_influence(
          causal_model,
          "X3",
          prediction_model="exact",
          num_samples_baseline=2000,
      )
      assert iccs["X0"] == approx(1, abs=0.3)
      assert iccs["X1"] == approx(0, abs=0.05)
      assert iccs["X2"] == approx(4, abs=0.5)
      assert iccs["X3"] == approx(1, abs=0.25)
      assert np.sum([iccs[key] for key in iccs]) == approx(
          estimate_variance(X3), abs=0.5
      )
  
imports: import networkx
  import numpy
  import pandas
  from flaky import flaky
  from pytest import approx
  from scipy import stats
  from sklearn.linear_model import LogisticRegression
  from dowhy.gcm import AdditiveNoiseModel, InvertibleStructuralCausalModel, ScipyDistribution, StructuralCausalModel, auto, fit, intrinsic_causal_influence
  from dowhy.gcm._noise import noise_samples_of_ancestors
  from dowhy.gcm.influence import intrinsic_causal_influence_sample
  from dowhy.gcm.ml import create_hist_gradient_boost_classifier, create_hist_gradient_boost_regressor, create_linear_regressor, create_linear_regressor_with_given_parameters
  from dowhy.gcm.uncertainty import estimate_entropy_of_probabilities, estimate_variance
  from dowhy.gcm.util.general import apply_one_hot_encoding, fit_one_hot_encoders
  from dowhy.graph import node_connected_subgraph_view
  from tests.gcm.test_noise import _persist_parents
label_desc: Use image node_id 1 for calling a global function with example usage: test_given_linear_data_when_estimate_intrinsic_causal_influence_with_variance_then_returns_expected_results() without return types