*! _fcoint_cv_fadl_single.ado -- FADL single frequency critical values
*! Banerjee et al. (2017) Tables 1a, 1b
program define _fcoint_cv_fadl_single, rclass
  syntax, n(integer) k(integer) tobs(integer) model(string)
  if `n' < 1 local n = 1
  if `n' > 3 local n = 3
  if `k' < 1 local k = 1
  if `k' > 5 local k = 5
  * Table 1a: Constant
  local c_1_1_1 "-4.73 -4.09 -3.76 -4.61 -4.03 -3.72 -4.60 -4.02 -3.72"
  local c_1_2_1 "-4.44 -3.75 -3.37 -4.33 -3.70 -3.36 -4.33 -3.70 -3.35"
  local c_1_3_1 "-4.21 -3.51 -3.14 -4.13 -3.48 -3.14 -4.15 -3.48 -3.14"
  local c_1_4_1 "-4.07 -3.38 -3.03 -4.01 -3.37 -3.04 -4.04 -3.38 -3.04"
  local c_1_5_1 "-4.00 -3.32 -2.97 -3.94 -3.32 -2.99 -3.96 -3.32 -3.00"
  local c_2_1_1 "-4.96 -4.32 -3.98 -4.85 -4.26 -3.95 -4.81 -4.25 -3.95"
  local c_2_2_1 "-4.79 -4.10 -3.73 -4.66 -4.03 -3.70 -4.64 -4.03 -3.70"
  local c_2_3_1 "-4.56 -3.87 -3.49 -4.48 -3.83 -3.49 -4.48 -3.83 -3.49"
  local c_2_4_1 "-4.43 -3.73 -3.36 -4.34 -3.70 -3.36 -4.36 -3.71 -3.38"
  local c_2_5_1 "-4.35 -3.65 -3.28 -4.27 -3.64 -3.30 -4.28 -3.65 -3.31"
  local c_3_1_1 "-5.17 -4.51 -4.17 -5.06 -4.46 -4.15 -5.02 -4.45 -4.14"
  local c_3_2_1 "-5.04 -4.36 -3.99 -4.94 -4.30 -3.96 -4.90 -4.29 -3.96"
  local c_3_3_1 "-4.90 -4.16 -3.79 -4.76 -4.13 -3.78 -4.75 -4.13 -3.78"
  local c_3_4_1 "-4.75 -4.03 -3.65 -4.64 -4.00 -3.65 -4.65 -4.01 -3.67"
  local c_3_5_1 "-4.66 -3.94 -3.57 -4.58 -3.94 -3.58 -4.56 -3.93 -3.60"
  * Table 1b: Constant + trend
  local c_1_1_2 "-5.17 -4.55 -4.24 -5.04 -4.47 -4.19 -5.00 -4.46 -4.18"
  local c_1_2_2 "-5.01 -4.34 -4.00 -4.86 -4.27 -3.96 -4.86 -4.27 -3.95"
  local c_1_3_2 "-4.79 -4.11 -3.76 -4.70 -4.07 -3.75 -4.68 -4.07 -3.74"
  local c_1_4_2 "-4.64 -3.96 -3.61 -4.58 -3.94 -3.61 -4.55 -3.95 -3.61"
  local c_1_5_2 "-4.53 -3.87 -3.52 -4.48 -3.86 -3.54 -4.46 -3.86 -3.54"
  local c_2_1_2 "-5.36 -4.72 -4.40 -5.23 -4.66 -4.37 -5.20 -4.65 -4.37"
  local c_2_2_2 "-5.22 -4.57 -4.23 -5.10 -4.51 -4.20 -5.07 -4.49 -4.19"
  local c_2_3_2 "-5.07 -4.39 -4.02 -4.95 -4.34 -4.01 -4.91 -4.32 -4.00"
  local c_2_4_2 "-4.94 -4.23 -3.87 -4.84 -4.22 -3.88 -4.81 -4.20 -3.87"
  local c_2_5_2 "-4.86 -4.15 -3.79 -4.76 -4.13 -3.80 -4.74 -4.13 -3.80"
  local c_3_1_2 "-5.54 -4.89 -4.55 -5.39 -4.83 -4.53 -5.39 -4.83 -4.53"
  local c_3_2_2 "-5.47 -4.77 -4.42 -5.30 -4.73 -4.40 -5.28 -4.70 -4.39"
  local c_3_3_2 "-5.33 -4.63 -4.27 -5.18 -4.57 -4.25 -5.18 -4.55 -4.23"
  local c_3_4_2 "-5.19 -4.49 -4.11 -5.08 -4.46 -4.12 -5.06 -4.44 -4.11"
  local c_3_5_2 "-5.08 -4.38 -4.01 -5.01 -4.36 -4.03 -4.99 -4.37 -4.03"
  local mi = 1
  if "`model'" == "trend" local mi = 2
  local cvstr = "`c_`n'_`k'_`mi''"
  tokenize `cvstr'
  if `tobs' <= 100 {
    local cv1  = `1'
    local cv5  = `2'
    local cv10 = `3'
  }
  else if `tobs' <= 500 {
    local w = (`tobs' - 100) / 400
    local cv1  = `1' + `w' * (`4' - `1')
    local cv5  = `2' + `w' * (`5' - `2')
    local cv10 = `3' + `w' * (`6' - `3')
  }
  else {
    local cv1  = `4'
    local cv5  = `5'
    local cv10 = `6'
  }
  return scalar cv1  = `cv1'
  return scalar cv5  = `cv5'
  return scalar cv10 = `cv10'
end