code: def refute_invertible_model(
      causal_model: InvertibleStructuralCausalModel,
      data: pd.DataFrame,
      independence_test: Callable[
          [np.ndarray, np.ndarray], float
      ] = kernel_based,
      significance_level: float = 0.05,
      fdr_control_method: Optional[str] = None,
  ) -> RejectionResult:
      """Validate the assumption that the structural causal models can be represented by a
      :py:class:`InvertibleFunctionalCausalModel <dowhy.gcm.graph.InvertibleFunctionalCausalModel>` (e.g. the causal mechanisms are
      :py:class:`AdditiveNoiseModels <dowhy.gcm.AdditiveNoiseModel>` and/or :py:class:`PostNonlinearModels <dowhy.gcm.PostNonlinearModel>`).
      For this, it is checked if the residual of a causal mechanism is independent of the mechanism's input
      (i.e. we assume causal sufficiency here). For instance, :py:class:`PostNonlinearModels <dowhy.gcm.PostNonlinearModel>` represent
          Y = f(g(X) + N),
      where f is invertible (g does not need to be), X are the parents of Y and N is (assumed to be) independent noise.
      The latter point is important here. For given data, we can then reconstruct N and perform an independence test between X and N.
  
      Note that this method only validates the causal mechanisms and not the graph structure.
  
      For the case of post non-linear models, see the following paper for more details:
          Zhang, K., and A. Hyvärinen.
          On the Identifiability of the Post-Nonlinear Causal Model.
          25th Conference on Uncertainty in Artificial Intelligence (UAI 2009). AUAI Press, 2009.
  
      :param causal_model: A fitted invertible structural causal model.
      :param data: Observations of variables in the DAG.
      :param independence_test: Independence test to use for checking if residual and input are dependent.
      :param significance_level: Significance level for deciding whether input and residual is dependent.
      :param fdr_control_method: Method for false discovery rate (FDR) control. For various options, please refer to `this page <https://www.statsmodels.org/dev/generated/statsmodels.stats.multitest.multipletests.html>`_.
      :return: The outcome of the validation. The causal model can not be rejected if all causal mechanisms are consistent with
               the invertible model assumption.
      """
      validate_causal_graph(causal_model.graph)
  
      all_p_values = []
  
      for node in causal_model.graph.nodes:
          if is_root_node(causal_model.graph, node):
              continue
          else:
              parents_samples = data[
                  get_ordered_predecessors(causal_model.graph, node)
              ].to_numpy()
              residuals = causal_model.causal_mechanism(
                  node
              ).estimate_noise(data[node].to_numpy(), parents_samples)
  
              all_p_values.append(
                  independence_test(parents_samples, residuals)
              )
  
      if fdr_control_method is None or len(all_p_values) == 0:
          return (
              RejectionResult.NOT_REJECTED
              if np.all(np.array(all_p_values) > significance_level)
              else RejectionResult.REJECTED
          )
      else:
          return (
              RejectionResult.REJECTED
              if np.any(
                  multipletests(
                      all_p_values,
                      significance_level,
                      method=fdr_control_method,
                  )[0]
              )
              else RejectionResult.NOT_REJECTED
          )
  
file_path: dowhy/dowhy/gcm/validation.py
imports: from enum import Enum, auto
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import networkx
  import numpy
  import pandas
  from statsmodels.stats.multitest import multipletests
  from dowhy.gcm.causal_models import InvertibleStructuralCausalModel, validate_causal_graph
  from dowhy.gcm.independence_test import kernel_based
  from dowhy.graph import DirectedGraph, get_ordered_predecessors, is_root_node
label_desc: Use image node_id 2 for calling a global function with example usage: refute_invertible_model(causal_model, data, independence_test, significance_level, fdr_control_method) and returns: unknown, unknown