code: def _refute_once(
      data: pd.DataFrame,
      target_estimand: IdentifiedEstimand,
      estimate: CausalEstimate,
      chosen_variables: Optional[List] = None,
      random_state: Optional[Union[int, np.random.RandomState]] = None,
      sample_size: Optional[int] = None,
      noise: float = 0.1,
      probability_of_change: Optional[float] = None,
  ):
      if random_state is None:
          new_data = resample(data, n_samples=sample_size)
      else:
          new_data = resample(
              data, n_samples=sample_size, random_state=random_state
          )
  
      if chosen_variables is not None:
          for variable in chosen_variables:
              if ("float" or "int") in new_data[variable].dtype.name:
                  scaling_factor = new_data[variable].std()
                  new_data[variable] += np.random.normal(
                      loc=0.0,
                      scale=noise * scaling_factor,
                      size=sample_size,
                  )
  
              elif "bool" in new_data[variable].dtype.name:
                  probs = np.random.uniform(0, 1, sample_size)
                  new_data[variable] = np.where(
                      probs < probability_of_change,
                      np.logical_not(new_data[variable]),
                      new_data[variable],
                  )
  
              elif "category" in new_data[variable].dtype.name:
                  categories = new_data[variable].unique()
                  # Find the set difference for each row
                  changed_data = new_data[variable].apply(
                      lambda row: list(set(categories) - set([row]))
                  )
                  # Choose one out of the remaining
                  changed_data = changed_data.apply(
                      lambda row: random.choice(row)
                  )
                  new_data[variable] = np.where(
                      probs < probability_of_change, changed_data
                  )
                  new_data[variable].astype("category")
  
      new_estimator = estimate.estimator.get_new_estimator_object(
          target_estimand
      )
      new_estimator.fit(
          new_data,
          estimate.estimator._effect_modifier_names,
          **new_estimator._econml_fit_params
          if isinstance(new_estimator, Econml)
          else {},
      )
      new_effect = new_estimator.estimate_effect(
          new_data,
          control_value=estimate.control_value,
          treatment_value=estimate.treatment_value,
          target_units=estimate.estimator._target_units,
      )
      return new_effect.value
  
file_path: dowhy/dowhy/causal_refuters/bootstrap_refuter.py
imports: import logging
  import random
  from typing import List, Optional, Union
  import numpy
  import pandas
  from joblib import Parallel, delayed
  from sklearn.utils import resample
  from tqdm.auto import tqdm
  from dowhy.causal_estimator import CausalEstimate
  from dowhy.causal_estimators.econml import Econml
  from dowhy.causal_identifier.identified_estimand import IdentifiedEstimand
  from dowhy.causal_refuter import CausalRefutation, CausalRefuter, choose_variables, test_significance
label_desc: Use image node_id 1 for calling a global function with example usage: _refute_once(data, target_estimand, estimate, chosen_variables, random_state, sample_size, noise, probability_of_change) and returns: new_effect