code: def weighted(x, weights):
      """Construct array for a weighted response
  
      Parameters
      ----------
      x : np.ndarray
          The values of the truncated variable.
      weights : np.ndarray
          The weight of each value in `x`.
  
      Returns
      ------
      np.ndarray
          Array of shape (n, 2). The first column contains the values of the `x` array and the second
          contains the values of `weights`.
      """
      x = np.asarray(x)
      weights = np.asarray(weights)
  
      if any(weights < 0):
          raise ValueError("Weights must be positive.")
  
      return np.column_stack([x, weights])
  
file_path: bambi/bambi/transformations.py
imports: import numpy
  import pandas
  from formulae.transforms import register_stateful_transform
label_desc: Use image node_id 5 for calling a global function with example usage: weighted(x, weights) and returns: np