code: def sensitivity_linear_partial_r2(
      data: pd.DataFrame,
      estimate: CausalEstimate,
      treatment_name: str,
      frac_strength_treatment: float = 1.0,
      frac_strength_outcome: float = 1.0,
      percent_change_estimate: float = 1.0,
      benchmark_common_causes: Optional[List[str]] = None,
      significance_level: Optional[float] = None,
      null_hypothesis_effect: Optional[float] = None,
      plot_estimate: bool = True,
  ) -> LinearSensitivityAnalyzer:
      """Add an unobserved confounder for refutation using Linear partial R2 methond (Sensitivity Analysis for linear models).
  
      :param data: pd.DataFrame: Data to run the refutation
      :param estimate: CausalEstimate: Estimate to run the refutation
      :param treatment_name: str: Name of the treatment
      :param frac_strength_treatment: float: This parameter decides the effect strength of the simulated confounder as a fraction of the effect strength of observed confounders on treatment. Defaults to 1.
      :param frac_strength_outcome: float: This parameter decides the effect strength of the simulated confounder as a fraction of the effect strength of observed confounders on outcome. Defaults to 1.
      :param percent_change_estimate: It is the percentage of reduction of treatment estimate that could alter the results (default = 1).
                                      if percent_change_estimate = 1, the robustness value describes the strength of association of confounders with treatment and outcome in order to reduce the estimate by 100% i.e bring it down to 0. (relevant only for Linear Sensitivity Analysis, ignore for rest)
      :param benchmark_common_causes: names of variables for bounding strength of confounders. (relevant only for partial-r2 based simulation methods)
      :param significance_level: confidence interval for statistical inference(default = 0.05). (relevant only for partial-r2 based simulation methods)
      :param null_hypothesis_effect: assumed effect under the null hypothesis. (relevant only for linear-partial-R2, ignore for rest)
      :param plot_estimate: Generate contour plot for estimate while performing sensitivity analysis. (default = True).
                              (relevant only for partial-r2 based simulation methods)
  
      """
  
      if not (
          isinstance(estimate.estimator, LinearRegressionEstimator)
      ):
          raise NotImplementedError(
              "Currently only LinearRegressionEstimator is supported for Sensitivity Analysis"
          )
  
      if (
          estimate.estimator._effect_modifier_names is not None
          and len(estimate.estimator._effect_modifier_names) > 0
      ):
          raise NotImplementedError(
              "The current implementation does not support effect modifiers"
          )
  
      if frac_strength_outcome == 1:
          frac_strength_outcome = frac_strength_treatment
  
      analyzer = LinearSensitivityAnalyzer(
          estimator=estimate.estimator,
          data=data,
          treatment_name=treatment_name,
          percent_change_estimate=percent_change_estimate,
          significance_level=significance_level,
          benchmark_common_causes=benchmark_common_causes,
          null_hypothesis_effect=null_hypothesis_effect,
          frac_strength_treatment=frac_strength_treatment,
          frac_strength_outcome=frac_strength_outcome,
          common_causes_order=estimate.estimator._observed_common_causes.columns,
      )
  
      analyzer.check_sensitivity(plot=plot_estimate)
      return analyzer
  
imports: import copy
  import logging
  import math
  from typing import Dict, List, Optional, Union
  import numpy
  import pandas
  import scipy.stats
  import statsmodels.api
  from sklearn.linear_model import LogisticRegression
  from sklearn.preprocessing import StandardScaler
  from tqdm.auto import tqdm
  from dowhy.causal_estimator import CausalEstimate
  from dowhy.causal_estimators.econml import Econml
  from dowhy.causal_estimators.linear_regression_estimator import LinearRegressionEstimator
  from dowhy.causal_estimators.regression_estimator import RegressionEstimator
  from dowhy.causal_identifier.identified_estimand import IdentifiedEstimand
  from dowhy.causal_refuter import CausalRefutation, CausalRefuter, choose_variables
  from dowhy.causal_refuters.evalue_sensitivity_analyzer import EValueSensitivityAnalyzer
  from dowhy.causal_refuters.linear_sensitivity_analyzer import LinearSensitivityAnalyzer
label_desc: Use image node_id 7 for calling a global function with example usage: sensitivity_linear_partial_r2(data, estimate, treatment_name, frac_strength_treatment, frac_strength_outcome, percent_change_estimate, benchmark_common_causes, significance_level, null_hypothesis_effect, plot_estimate) and returns: analyzer