code: def run_linear_regression(
      genotype_df, phenotype_df, covariate_df, add_intercept=True
  ):
      phenotype_names = phenotype_df.columns.astype("str").to_series()
      C = covariate_df.to_numpy("float64", copy=True)
      if add_intercept:
          C = gwas_fx._add_intercept(C, genotype_df.shape[0])
      if not C.size:
          C = np.zeros((genotype_df.shape[0], 1))
      Y = phenotype_df.to_numpy("float64", copy=True)
      Y_mask = ~np.isnan(Y)
      Y[~Y_mask] = 0
      Y -= Y.mean(axis=0)
      Q = np.linalg.qr(C)[0]
      Y = gwas_fx._residualize_in_place(Y, Q) * Y_mask
      Y_scale = np.ones(Y.shape[1])
      Y_state = lr._create_YState(
          Y, phenotype_df, pd.DataFrame({}), Y_mask, np.float64, None
      )
      dof = C.shape[0] - C.shape[1] - 1
      pdf = pd.DataFrame(
          {
              lr._VALUES_COLUMN_NAME: list(
                  genotype_df.to_numpy("float64").T
              )
          }
      )
  
      return lr._linear_regression_inner(
          pdf,
          Y_state,
          Y_mask.astype("float64"),
          Y_scale,
          Q,
          dof,
          phenotype_names,
          None,
          None,
          None,
      )
  
imports: import functions
  import numpy
  import statsmodels.api
  import pandas
  import glow.gwas.functions
  import glow.gwas.lin_reg
  import pytest
label_desc: Use image node_id 1 for calling a global function with example usage: run_linear_regression(genotype_df, phenotype_df, covariate_df, add_intercept) and returns: lr