code: def _generate_linreg_output(
      genotype_df,
      sql_type,
      Y_state,
      Y_mask,
      Y_scale,
      Q,
      dof,
      phenotype_df,
      Y_for_verbose_output,
      verbose_output,
      gt_indices_to_drop,
  ) -> DataFrame:
      # Construct output schema
      result_fields = [
          StructField("effect", sql_type),
          StructField("stderror", sql_type),
          StructField("tvalue", sql_type),
          StructField("pvalue", sql_type),
          StructField("phenotype", StringType()),
      ]
  
      if verbose_output:
          result_fields += [
              StructField("n", IntegerType()),
              StructField("sum_x", sql_type),
              StructField("y_transpose_x", sql_type),
          ]
  
      result_struct = gwas_fx._output_schema(
          genotype_df.schema.fields, result_fields
      )
  
      def map_func(pdf_iterator):
          for pdf in pdf_iterator:
              yield gwas_fx._loco_dispatch(
                  pdf,
                  Y_state,
                  _linear_regression_inner,
                  Y_mask,
                  Y_scale,
                  Q,
                  dof,
                  phenotype_df.columns.to_series().astype("str"),
                  Y_for_verbose_output,
                  verbose_output,
                  gt_indices_to_drop,
              )
  
      return genotype_df.mapInPandas(map_func, result_struct)
  
file_path: glow/python/glow/gwas/lin_reg.py
imports: import pandas
  import numpy
  from nptyping import Float, NDArray, Int32
  from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Union
  from pyspark.sql import Column, DataFrame
  from pyspark.sql.types import StringType, StructField, IntegerType
  from scipy import stats
  from typeguard import typechecked
  from .None import functions
  from .functions import _VALUES_COLUMN_NAME, _get_indices_to_drop
  from ..wgr.wgr_functions import _get_contigs_from_loco_df
label_desc: Use image node_id 5 for calling a global function with example usage: _generate_linreg_output(genotype_df, sql_type, Y_state, Y_mask, Y_scale, Q, dof, phenotype_df, Y_for_verbose_output, verbose_output, gt_indices_to_drop) and returns: genotype_df