code: def _model2dataframe(
      model_endog, model_exog, model_type=OLS, **kwargs
  ):
      """return a series containing the summary of a linear model
  
      All the exceding parameters will be redirected to the linear model
      """
      # create the linear model and perform the fit
      model_result = model_type(model_endog, model_exog, **kwargs).fit()
      # keeps track of some global statistics
      statistics = pd.Series(
          {
              "r2": model_result.rsquared,
              "adj_r2": model_result.rsquared_adj,
          }
      )
      # put them togher with the result for each term
      result_df = pd.DataFrame(
          {
              "params": model_result.params,
              "pvals": model_result.pvalues,
              "std": model_result.bse,
              "statistics": statistics,
          }
      )
      # add the complexive results for f-value and the total p-value
      fisher_df = pd.DataFrame(
          {
              "params": {"_f_test": model_result.fvalue},
              "pvals": {"_f_test": model_result.f_pvalue},
          }
      )
      # merge them and unstack to obtain a hierarchically indexed series
      res_series = pd.concat([result_df, fisher_df]).unstack()
      return res_series.dropna()
  
file_path: statsmodels/statsmodels/sandbox/multilinear.py
imports: from patsy import dmatrix
  import pandas
  from statsmodels.api import OLS
  from statsmodels.api import stats
  import numpy
  import logging
label_desc: Use image node_id 1 for calling a global function with example usage: _model2dataframe(model_endog, model_exog, model_type) and returns: res_series