code: def analyze(
      problem: Dict,
      X: np.ndarray,
      Y: np.ndarray,
      num_resamples: int = 100,
      conf_level: float = 0.95,
      print_to_console: bool = False,
      seed: int = None,
      y_resamples: int = None,
      method: str = "all",
  ) -> Dict:
      """Perform Delta Moment-Independent Analysis on model outputs.
  
      Returns a dictionary with keys 'delta', 'delta_conf', 'S1', and 'S1_conf'
      (first-order sobol indices), where each entry is a list of size D
      (the number of parameters) containing the indices in the same order as the
      parameter file.
  
  
      Notes
      -----
      Compatible with:
          all samplers
  
  
      Examples
      --------
          >>> X = latin.sample(problem, 1000)
          >>> Y = Ishigami.evaluate(X)
          >>> Si = delta.analyze(problem, X, Y, print_to_console=True)
  
  
      Parameters
      ----------
      problem : dict
          The problem definition
      X: numpy.matrix
          A NumPy matrix containing the model inputs
      Y : numpy.array
          A NumPy array containing the model outputs
      num_resamples : int
          The number of resamples when computing confidence intervals (default 100)
      conf_level : float
          The confidence interval level (default 0.95)
      print_to_console : bool
          Print results directly to console (default False)
      y_resamples : int, optional
          Number of samples to use when resampling (bootstrap) (default None)
      method : {"all", "delta", "sobol"}, optional
          Whether to compute "delta", "sobol" or both ("all") indices (default "all")
  
  
      References
      ----------
      1. Borgonovo, E. (2007). "A new uncertainty importance measure."
             Reliability Engineering & System Safety, 92(6):771-784,
             doi:10.1016/j.ress.2006.04.015.
  
      2. Plischke, E., E. Borgonovo, and C. L. Smith (2013). "Global
             sensitivity measures from given data." European Journal of
             Operational Research, 226(3):536-550, doi:10.1016/j.ejor.2012.11.047.
      """
      if seed:
          np.random.seed(seed)
  
      D = problem["num_vars"]
      if y_resamples is None:
          y_resamples = Y.size
  
      if not y_resamples <= Y.size:
          raise ValueError(
              "y_resamples must be less than or equal to the total number of samples"
          )
  
      if not 0 < conf_level < 1:
          raise RuntimeError("Confidence level must be between 0-1.")
  
      # equal frequency partition
      exp = 2.0 / (7.0 + np.tanh((1500.0 - y_resamples) / 500.0))
      M = int(np.round(min(int(np.ceil(y_resamples**exp)), 48)))
      m = np.linspace(0, y_resamples, M + 1)
      Ygrid = np.linspace(np.min(Y), np.max(Y), 100)
  
      keys = ("delta", "delta_conf", "S1", "S1_conf")
      S = ResultDict((k, np.zeros(D)) for k in keys)
      S["names"] = problem["names"]
  
      try:
          for i in range(D):
              X_i = X[:, i]
              if method in ["all", "delta"]:
                  (
                      S["delta"][i],
                      S["delta_conf"][i],
                  ) = bias_reduced_delta(
                      Y,
                      Ygrid,
                      X_i,
                      m,
                      num_resamples,
                      conf_level,
                      y_resamples,
                  )
              if method in ["all", "sobol"]:
                  ind = np.random.randint(Y.size, size=y_resamples)
                  S["S1"][i] = sobol_first(Y[ind], X_i[ind], m)
                  S["S1_conf"][i] = sobol_first_conf(
                      Y, X_i, m, num_resamples, conf_level, y_resamples
                  )
      except np.linalg.LinAlgError as e:
          msg = "Singular matrix detected\n"
          msg += "This may be due to the sample size ({}) being too small\n".format(
              Y.size
          )
          msg += "If this is not the case, check Y values or raise an issue with the\n"
          msg += "SALib team"
  
          raise np.linalg.LinAlgError(msg) from e
  
      if print_to_console:
          print(S.to_df())
  
      return S
  
file_path: SALib/src/SALib/analyze/delta.py
imports: from typing import Dict
  from scipy.stats import norm, gaussian_kde, rankdata
  import numpy
  from .None import common_args
  from ..util import read_param_file, ResultDict
label_desc: Use image node_id 1 for calling a global function with example usage: analyze(problem, X, Y, num_resamples, conf_level, print_to_console, seed, y_resamples, method) and returns: S