code: def _compute_elementary_effects(
      model_inputs: np.ndarray,
      model_outputs: np.ndarray,
      trajectory_size: int,
      delta: float,
      scaling: bool = False,
  ) -> np.ndarray:
      """Computes the Morris elementary effects.
  
      Parameters
      ----------
      model_inputs: np.ndarray
          matrix of inputs to the model under analysis.
          x-by-r where x is the number of variables and
          r is the number of rows (a function of x and num_trajectories)
      model_outputs: np.ndarray
          r-length vector of model outputs
      trajectory_size: int
          Number of points in a trajectory
      delta: float
          Scaling factor computed from `num_levels`
      scaling: bool
          True if the elementary effects should be in scaled as in [1]
  
      Returns
      ---------
      elementary_effects : np.array
          Elementary effects for each parameter
  
      References
      ----------
      1. Sin and Gearney (2009)
         Improving the Morris Method for Sensitivity Analysis
         by Scaling the Elementary Effects.
         19th European Symposium on Computer Aided Process Engineering ESCAPE19:925-930
  
      2. Moret et al. (2017)
          Characterization of input uncertainties in strategic
          energy planning models.
          Applied Energy, Volume 202, 15 September 2017, Pages 597-617
          https://doi.org/10.1016/j.apenergy.2017.05.106
      """
      num_trajectories = _calculate_number_trajectories(
          model_inputs, trajectory_size
      )
  
      output_matrix = _reshape_model_outputs(
          model_outputs, num_trajectories, trajectory_size
      )
      input_matrix = _reshape_model_inputs(
          model_inputs, num_trajectories, trajectory_size
      )
  
      delta_variables = _calculate_delta_input_variables(input_matrix)
      value_increased = delta_variables > 0
      value_decreased = delta_variables < 0
  
      result_increased = _reorganize_output_matrix(
          output_matrix, value_increased, value_decreased
      )
      result_decreased = _reorganize_output_matrix(
          output_matrix,
          value_increased,
          value_decreased,
          increase=False,
      )
  
      difference = _calc_results_difference(
          result_increased, result_decreased
      )
  
      if scaling:
          # calculate the scaled value of delta (step size)
          dx_trajectory = _calculate_step_size_x(input_matrix)
  
          see_dy_dx = np.divide(difference, dx_trajectory.T)
  
          sigma_x_per_trajectory = np.std(input_matrix, axis=1)
          sigma_y_per_trajectory = np.std(output_matrix, axis=1)
  
          # Create a mask to avoid division by zero
          mask = sigma_y_per_trajectory[:, np.newaxis] != 0
  
          adjustment_trajectory = np.divide(
              sigma_x_per_trajectory,
              sigma_y_per_trajectory[:, np.newaxis],
              out=np.zeros_like(sigma_x_per_trajectory),
              where=mask,
          )
          elementary_effects = see_dy_dx * adjustment_trajectory.T
  
      else:
          elementary_effects = difference / delta
  
      return elementary_effects
  
imports: from typing import Dict, List
  import numpy
  from scipy.stats import norm
  from .None import common_args
  from ..util import read_param_file, compute_groups_matrix, ResultDict, _define_problem_with_groups, _compute_delta, _check_groups
label_desc: Use image node_id 6 for calling a global function with example usage: _compute_elementary_effects(model_inputs, model_outputs, trajectory_size, delta, scaling) and returns: elementary_effects