code: def test_mvmean_2indep(data1, data2):
      """Hotellings test for multivariate mean in two independent samples
  
      The null hypothesis is that both samples have the same mean.
      The alternative hypothesis is that means differ.
  
      Parameters
      ----------
      data1 : array_like
          first sample data with observations in rows and variables in columns
      data2 : array_like
          second sample data with observations in rows and variables in columns
  
      Returns
      -------
      results : instance of a results class with attributes
          statistic, pvalue, t2 and df
      """
      x1 = array_like(data1, "x1", ndim=2)
      x2 = array_like(data2, "x2", ndim=2)
      nobs1, k_vars = x1.shape
      nobs2, k_vars2 = x2.shape
      if k_vars2 != k_vars:
          msg = "both samples need to have the same number of columns"
          raise ValueError(msg)
      mean1 = x1.mean(0)
      mean2 = x2.mean(0)
      cov1 = np.cov(x1, rowvar=False, ddof=1)
      cov2 = np.cov(x2, rowvar=False, ddof=1)
      nobs_t = nobs1 + nobs2
      combined_cov = ((nobs1 - 1) * cov1 + (nobs2 - 1) * cov2) / (
          nobs_t - 2
      )
      diff = mean1 - mean2
      t2 = (
          (nobs1 * nobs2)
          / nobs_t
          * diff
          @ np.linalg.solve(combined_cov, diff)
      )
      factor = ((nobs_t - 2) * k_vars) / (nobs_t - k_vars - 1)
      statistic = t2 / factor
      df = (k_vars, nobs_t - 1 - k_vars)
      pvalue = stats.f.sf(statistic, df[0], df[1])
      return HolderTuple(
          statistic=statistic, pvalue=pvalue, df=df, t2=t2, distr="F"
      )
  
file_path: statsmodels/statsmodels/stats/multivariate.py
imports: import numpy
  from scipy import stats
  from statsmodels.stats.moment_helpers import cov2corr
  from statsmodels.stats.base import HolderTuple
  from statsmodels.tools.validation import array_like
label_desc: Use image node_id 3 for calling a global function with example usage: test_mvmean_2indep(data1, data2) and returns: HolderTuple