code: def f_test(Y, f0, Y_em, R, alpha, m1, m2, m3, n1, n2, n3, n):
      """Use F-test for model selection."""
      # Initialize ind with zeros (all terms insignificant)
      select = np.zeros(n)
  
      # Determine the significant components of the HDMR model via the F-test
      Y_res0 = Y - f0
      SSR0 = np.sum(np.square(Y_res0))
      p0 = 0
      for i in range(n):
          # model with ith term included
          Y_res1 = Y_res0 - Y_em[:, i]
  
          # Number of parameters of proposed model (order dependent)
          if i <= n1:
              p1 = m1  # 1st order
          elif n1 < i <= (n1 + n2):
              p1 = m2  # 2nd order
          else:
              p1 = m3  # 3rd order
  
          # Calculate SSR of Y1
          SSR1 = np.sum(np.square(Y_res1))
  
          # Now calculate the F_stat (F_stat > 0 -> SSR1 < SSR0 )
          F_stat = ((SSR0 - SSR1) / (p1 - p0)) / (SSR1 / (R - p1))
  
          # Now calculate critical F value
          F_crit = stats.f.ppf(q=alpha, dfn=p1 - p0, dfd=R - p1)
  
          # Now determine whether to accept ith component into model
          if F_stat > F_crit:
              # ith term is significant and should be included in model
              select[i] = 1
  
      return select
  
imports: from typing import Dict
  from types import MethodType
  import itertools
  import time
  import warnings
  import numpy
  from numpy.linalg import solve
  from numpy.linalg import svd
  from numpy import identity
  import pandas
  from scipy import stats, special, interpolate
  from .None import common_args
  from ..util import read_param_file, ResultDict
  from SALib.plotting.hdmr import plot
  from SALib.util.problem import ProblemSpec
label_desc: Use image node_id 9 for calling a global function with example usage: f_test(Y, f0, Y_em, R, alpha, m1, m2, m3, n1, n2, n3, n) and returns: select