*! version 1.1.5 24nov2026 Taha Zaghdoudi, zedtaha@gmail.com *! Fourier CUSUM test for the null of cointegration *! Stata port of the R package FCUSUM 1.1.0 (CRAN) program define fcusum, rclass sortpreserve version 14.0 syntax varlist(min=2 numeric ts) [if] [in] [, /// KSTAR(integer 3) /// FREQ(string) /// FOURier(string) /// PREtest(real 0.05) /// CV(string) /// BOOT(string) /// REPS(integer 499) /// Q(integer -1) /// QMAX(integer -1) /// BW(string) /// STEP(real 0.01) /// SEED(string) /// RESID(name) /// GRAPH /// GLEVel(integer 5) /// noCOEF /// ] // ---- options ----------------------------------------------------------- _fcusum_opt freq "`freq'" "fractional integer" "fractional" local freq `s(choice)' _fcusum_opt fourier "`fourier'" "auto always never" "auto" local fourier `s(choice)' _fcusum_opt cv "`cv'" "bootstrap table" "bootstrap" local cv `s(choice)' _fcusum_opt boot "`boot'" "iid sieve" "iid" local boot `s(choice)' _fcusum_opt bw "`bw'" "nw kurozumi andrews" "nw" local bw `s(choice)' if `kstar' < 1 { di as err "kstar() must be a positive integer" exit 198 } if `step' <= 0 | `step' > 1 { di as err "step() must be in (0, 1]" exit 198 } if `pretest' <= 0 | `pretest' >= 1 { di as err "pretest() must be in (0, 1)" exit 198 } if `reps' < 19 { di as err "reps() must be at least 19" exit 198 } if `q' < -1 { di as err "q() must be a non-negative integer" exit 198 } if `qmax' < -1 { di as err "qmax() must be a non-negative integer" exit 198 } if !inlist(`glevel', 1, 5, 10) { di as err "glevel() must be 1, 5 or 10" exit 198 } if "`resid'" != "" confirm new variable `resid' // ---- time-series checks ----------------------------------------------- capture tsset if _rc { di as err "data must be {bf:tsset}" exit 111 } qui tsset if "`r(panelvar)'" != "" { di as err "fcusum is for a single time series; data are tsset as a panel" exit 459 } local tvar "`r(timevar)'" local tdelta = r(tdelta) marksample touse sort `tvar' qui count if `touse' local N = r(N) if `N' < 20 { di as err "insufficient observations (`N')" exit 2001 } qui summarize `tvar' if `touse', meanonly if round((r(max) - r(min)) / `tdelta') + 1 != `N' { di as err "the estimation sample must not contain gaps in `tvar'" exit 498 } gettoken depname xnames : varlist local xnames = strtrim("`xnames'") local p : word count `xnames' tsrevar `varlist' local tsvars `r(varlist)' gettoken ytmp xtmp : tsvars // ---- run -------------------------------------------------------------- tempname bmat tempvar rvar pvar qui gen double `rvar' = . qui gen double `pvar' = . if "`seed'" != "" { local oldrng = c(rngstate) set seed `seed' } capture noisily mata: _fcusum_main("`ytmp'", "`xtmp'", "`xnames'", /// "`touse'", `kstar', "`freq'", "`fourier'", `pretest', "`cv'", /// "`boot'", `reps', `q', `qmax', "`bw'", `step', "`rvar'", /// "`pvar'", "`bmat'") local rc = _rc if "`seed'" != "" set rngstate `oldrng' if `rc' exit `rc' // ---- display ---------------------------------------------------------- local retained = cond(`fret', "retained", "dropped") if "`fourier'" != "auto" local retained `"`retained' (fourier(`fourier'))"' local pct = 100 * `pretest' di di as txt "Fourier CUSUM test for the null of cointegration" di as txt "{hline 66}" di as txt "H0: cointegration | H1: no cointegration" di as txt "Dependent variable: " as res "`depname'" /// as txt " Regressors: " as res "`xnames'" di di as txt "Step 1 - Fourier pre-test (sup-F)" di as txt " sup-F = " as res %8.4f `supf' /// as txt " p-value: " as res "`supf_plab'" /// as txt " (" `pct' "% c.v. = " as res %7.4f `supf_cvl' as txt ")" di as txt " Selected frequency k-hat: " as res %6.0g `khat' /// as txt " (`freq' grid, k* = `kstar')" di as txt " Fourier terms `retained'" di di as txt "Step 2 - `test' test" di as txt " CUSUM statistic: " as res %8.4f `stat' " `stars'" di as txt " p-value: " as res "`plab'" di as txt " Critical values (`cvsrc'):" di as txt " 10%: " as res %7.4f `cv10' /// as txt " 5%: " as res %7.4f `cv5' /// as txt " 1%: " as res %7.4f `cv1' di di as txt "Decision: " as res "`decision'" di di as txt "Both CUSUM statistics: Fourier = " as res %7.4f `statf' /// as txt " Xiao-Phillips = " as res %7.4f `statp' di as txt "DOLS leads/lags: " as res `qsel' /// as txt " | Obs. used: " as res `nobs' /// as txt " | Bartlett LRV: " as res %9.4g `lrv' /// as txt " (`bw', " as res `bwlags' as txt " lags)" if "`coef'" != "nocoef" { di di as txt "DOLS coefficients (`test' model)" di as txt "{hline 13}{c TT}{hline 14}" local names : colnames `bmat' local j 0 foreach nm of local names { local ++j di as txt %12s abbrev("`nm'", 12) " {c |}" as res %13.5g `bmat'[1, `j'] } di as txt "{hline 13}{c BT}{hline 14}" if `qsel' > 0 { di as txt "Leads/lags of D.x not shown. " _c } di as txt "OLS standard errors are not valid for DOLS inference." } // ---- optional outputs ------------------------------------------------- if "`resid'" != "" { qui gen double `resid' = `rvar' label variable `resid' "fcusum residuals (`test' model)" } if "`graph'" != "" { local c = `cv`glevel'' local mc = -`c' twoway (line `pvar' `tvar' if !missing(`pvar')), /// yline(`mc' `c', lpattern(dash)) /// yline(0, lcolor(gs10)) /// ytitle("Scaled CUSUM of residuals") xtitle("") /// title("`test' path") legend(off) /// note("Dashed lines: `glevel'% critical value") } // ---- stored results --------------------------------------------------- return scalar stat = `stat' return scalar p = `pval' return scalar cv10 = `cv10' return scalar cv5 = `cv5' return scalar cv1 = `cv1' return scalar supF = `supf' return scalar supF_p = `supf_p' return scalar supF_cv = `supf_cvl' return scalar supF_cv10 = `supf_cv10' return scalar supF_cv5 = `supf_cv5' return scalar supF_cv1 = `supf_cv1' return scalar fourier = `fret' return scalar khat = `khat' return scalar stat_fourier = `statf' return scalar stat_plain = `statp' return scalar lrv = `lrv' return scalar bwlags = `bwlags' return scalar q = `qsel' return scalar kstar = `kstar' return scalar reps = `reps' return scalar n_regs = `p' return scalar N = `nobs' return local test "`test'" return local decision "`decision'" return local cvsource "`cvsrc'" return local freq "`freq'" return local bw "`bw'" return local boot "`boot'" return local depvar "`depname'" return local indepvars "`xnames'" return local cmd "fcusum" return matrix b = `bmat' end // Match a (possibly abbreviated) string option against allowed choices program define _fcusum_opt, sclass args optname value choices default sreturn clear local value = lower(strtrim(`"`value'"')) if `"`value'"' == "" { sreturn local choice "`default'" exit } local hit local nhit 0 foreach c of local choices { if `"`value'"' == substr("`c'", 1, length(`"`value'"')) { local hit `c' local ++nhit } } if `nhit' != 1 { di as err `"`optname'() must be one of: `choices'"' exit 198 } sreturn local choice "`hit'" end version 14.0 mata: mata set matastrict on // ---- Built-in tables (FCUSUM 1.1.0, R/sysdata.rda) --------------------------- // columns: quantiles at probabilities _fcusum_probs(); one row per statement real rowvector _fcusum_probs() { return((0.50, 0.75, 0.80, 0.85, 0.90, 0.925, 0.95, 0.975, 0.99)) } // Xiao-Phillips CUSUM, row = p (1..4); T = 1000, 20,000 replications real matrix _fcusum_tab_plain() { real matrix T T = J(4, 9, .) T[1, .] = (0.71663767, 0.87795254, 0.92429776, 0.97919618, 1.05522460, 1.11116752, 1.18520876, 1.29468289, 1.44114294) T[2, .] = (0.64964383, 0.78118764, 0.81945811, 0.86775655, 0.93068185, 0.97561281, 1.03650818, 1.13444878, 1.26938467) T[3, .] = (0.59954585, 0.71509798, 0.74713706, 0.78955078, 0.84737638, 0.88509451, 0.94077167, 1.03853188, 1.14754969) T[4, .] = (0.56081747, 0.66039286, 0.69103491, 0.72703846, 0.77668444, 0.80905263, 0.85612434, 0.93238595, 1.03092911) return(T) } // sup-F pre-test; row = 20*(freq=="integer") + 4*(kstar-1) + p // (p = 1..4, kstar = 1..5); T = 500, 5,000 replications real matrix _fcusum_tab_supf() { real matrix T T = J(40, 9, .) T[1, .] = (1.05509180, 1.89619519, 2.18020900, 2.56153045, 3.02619921, 3.34601065, 3.80731549, 4.71867657, 5.55986264) T[2, .] = (1.16336729, 2.06831320, 2.35698022, 2.71067770, 3.18280980, 3.52581234, 4.04081475, 4.97100211, 6.20458961) T[3, .] = (1.20546880, 2.10994221, 2.42288909, 2.78716099, 3.33615299, 3.73226124, 4.17376732, 5.06857777, 6.31939115) T[4, .] = (1.22220898, 2.11131825, 2.39402161, 2.77716106, 3.32077991, 3.69000862, 4.14796007, 4.91371597, 6.44419234) T[5, .] = (1.66757747, 2.65033306, 2.94656793, 3.35000257, 3.87304026, 4.19035287, 4.65271225, 5.60580386, 6.78499666) T[6, .] = (1.63985086, 2.65495939, 2.95336265, 3.34588344, 3.89114678, 4.30157721, 4.83491676, 5.81176962, 7.08910144) T[7, .] = (1.69330227, 2.74311032, 3.05040518, 3.46401290, 4.01863226, 4.38166373, 4.97768673, 5.78957093, 6.99057297) T[8, .] = (1.73855995, 2.76771747, 3.11620579, 3.55091123, 4.09932820, 4.52090166, 5.02208038, 5.99913469, 7.09737697) T[9, .] = (2.09392307, 3.11590993, 3.41362422, 3.76172313, 4.23329052, 4.59571346, 5.11312501, 6.03683067, 7.30295112) T[10, .] = (2.08993607, 3.18042595, 3.47502303, 3.86637449, 4.44315556, 4.77287175, 5.26421616, 6.18579179, 7.43318376) T[11, .] = (2.08356278, 3.18314259, 3.46640212, 3.89966719, 4.43087233, 4.86632426, 5.38492519, 6.38452160, 7.59345197) T[12, .] = (2.12937287, 3.24960647, 3.61598256, 4.01873461, 4.56192702, 4.95452582, 5.55373845, 6.49260705, 7.72736441) T[13, .] = (2.40848468, 3.52913015, 3.84896470, 4.25338759, 4.79775520, 5.12661237, 5.61999876, 6.59149158, 7.72241110) T[14, .] = (2.44979937, 3.57346305, 3.89313704, 4.29412453, 4.81983144, 5.20797721, 5.74133270, 6.59968270, 7.77617830) T[15, .] = (2.44737335, 3.58023297, 3.87632198, 4.30654303, 4.82551714, 5.24203103, 5.84120272, 6.70617698, 8.07162082) T[16, .] = (2.49022717, 3.65698080, 3.99162929, 4.42123006, 5.01983124, 5.42212615, 5.95389841, 6.98120043, 8.43065622) T[17, .] = (2.76346960, 3.82255063, 4.15692792, 4.59638426, 5.17188890, 5.60437876, 6.20529988, 7.10133286, 8.10015149) T[18, .] = (2.75456949, 3.81434259, 4.15869141, 4.53702238, 5.14674666, 5.47000857, 5.97595404, 6.87474140, 8.10407231) T[19, .] = (2.75020457, 3.92901395, 4.27512290, 4.69046170, 5.33545521, 5.66205833, 6.25077885, 7.25869676, 8.66155006) T[20, .] = (2.81292049, 4.02304509, 4.37213960, 4.81764533, 5.36214179, 5.75879206, 6.26007895, 7.15744356, 8.68891031) T[21, .] = (0.74598101, 1.47753786, 1.72226993, 2.05088914, 2.44972533, 2.79892369, 3.22965669, 3.85869233, 4.86009334) T[22, .] = (0.74192307, 1.53341868, 1.77486644, 2.11366284, 2.56735253, 2.86150091, 3.32702512, 4.13958182, 5.25652515) T[23, .] = (0.78064025, 1.56114350, 1.79142223, 2.14486295, 2.64938922, 2.95048198, 3.41538870, 4.37070164, 5.22573372) T[24, .] = (0.76503378, 1.55677677, 1.82023409, 2.13239300, 2.66570732, 2.98845770, 3.38622908, 4.20484711, 5.34665622) T[25, .] = (1.25963864, 2.11977265, 2.37649866, 2.69385202, 3.14325878, 3.46428928, 3.92130245, 4.64353437, 5.54214308) T[26, .] = (1.27427077, 2.14313618, 2.39130653, 2.76481175, 3.21843758, 3.53469497, 4.03101056, 4.91305954, 6.09618104) T[27, .] = (1.29159192, 2.15810316, 2.43083496, 2.79275028, 3.29208099, 3.67634966, 4.19593831, 4.93487076, 6.28206036) T[28, .] = (1.31527548, 2.25032416, 2.56273119, 2.93211972, 3.46698504, 3.89375100, 4.38499028, 5.22252369, 6.29811106) T[29, .] = (1.67382612, 2.56670928, 2.84020453, 3.18565406, 3.64507007, 3.99328136, 4.45005497, 5.14668863, 6.09504910) T[30, .] = (1.70367592, 2.58464219, 2.88170815, 3.20132425, 3.63207618, 4.01475878, 4.46015311, 5.31538914, 6.39177034) T[31, .] = (1.70181504, 2.60054337, 2.86088595, 3.23277722, 3.73603199, 4.07796620, 4.61445975, 5.39829217, 6.70559973) T[32, .] = (1.68995108, 2.65130436, 2.95088934, 3.27673518, 3.79991919, 4.17302081, 4.66272171, 5.51844095, 6.71003525) T[33, .] = (1.93970529, 2.86311955, 3.13995407, 3.48090505, 3.96775005, 4.34487081, 4.78341620, 5.44245891, 6.46869947) T[34, .] = (1.95287592, 2.91287893, 3.19235318, 3.55630139, 4.01453295, 4.36814808, 4.79876888, 5.69390586, 6.60889433) T[35, .] = (1.99248754, 2.95453208, 3.21864486, 3.56065696, 4.06439431, 4.46014451, 4.93445395, 5.84513668, 6.99248166) T[36, .] = (1.97307892, 2.89844564, 3.20086510, 3.57045665, 4.10204584, 4.51941726, 5.01251974, 5.80065964, 6.97687772) T[37, .] = (2.20512882, 3.14296241, 3.40400748, 3.75164727, 4.22340137, 4.57353858, 5.05679188, 5.85514560, 6.75159545) T[38, .] = (2.24293173, 3.19167222, 3.46481463, 3.83138926, 4.28103006, 4.56496225, 4.99036485, 5.77674542, 6.86795907) T[39, .] = (2.23258002, 3.16559806, 3.44573184, 3.80971160, 4.33527547, 4.68398728, 5.20619474, 6.28095260, 7.30964039) T[40, .] = (2.24979772, 3.23062280, 3.56035957, 3.94434106, 4.47557165, 4.79676806, 5.32378226, 6.16050792, 7.21962074) return(T) } // Fourier CUSUM at a fixed frequency; row = 50*(p-1) + 10*k // (p = 1..4, k = 0.1, 0.2, ..., 5); T = 1000, 20,000 replications real matrix _fcusum_tab_fixed() { real matrix T T = J(200, 9, .) T[1, .] = (0.50088437, 0.57818824, 0.59947345, 0.62451378, 0.65768704, 0.68047273, 0.71039681, 0.75661038, 0.81773802) T[2, .] = (0.49829684, 0.57409958, 0.59487557, 0.61964183, 0.65228142, 0.67421164, 0.70360162, 0.74946565, 0.80726633) T[3, .] = (0.49598850, 0.57019022, 0.59042006, 0.61479853, 0.64682971, 0.66792365, 0.69684592, 0.74245972, 0.79797759) T[4, .] = (0.49423204, 0.56715040, 0.58682682, 0.61082393, 0.64231636, 0.66268430, 0.69135893, 0.73704362, 0.79141020) T[5, .] = (0.49357029, 0.56599688, 0.58543057, 0.60921210, 0.64050395, 0.66065061, 0.68929062, 0.73547903, 0.78948425) T[6, .] = (0.49470392, 0.56780023, 0.58751216, 0.61148270, 0.64336478, 0.66392983, 0.69291092, 0.74013042, 0.79511471) T[7, .] = (0.49832789, 0.57378277, 0.59438828, 0.61929563, 0.65285792, 0.67451902, 0.70471371, 0.75427166, 0.81262127) T[8, .] = (0.50469744, 0.58453234, 0.60665768, 0.63330766, 0.66963432, 0.69317630, 0.72577753, 0.77931288, 0.84303661) T[9, .] = (0.51343356, 0.59971808, 0.62382786, 0.65298487, 0.69310284, 0.71937832, 0.75544895, 0.81478784, 0.88581333) T[10, .] = (0.52372454, 0.61813763, 0.64464862, 0.67706787, 0.72190916, 0.75177264, 0.79220197, 0.85928905, 0.94012325) T[11, .] = (0.53488749, 0.63833212, 0.66761022, 0.70385494, 0.75428370, 0.78850262, 0.83400812, 0.91078105, 1.00399027) T[12, .] = (0.54653811, 0.65913809, 0.69134835, 0.73179018, 0.78852885, 0.82749461, 0.87869253, 0.96679019, 1.07412988) T[13, .] = (0.55850017, 0.67984374, 0.71500545, 0.75943487, 0.82227995, 0.86565199, 0.92229722, 1.02219634, 1.14416289) T[14, .] = (0.57058091, 0.69996465, 0.73782708, 0.78547054, 0.85319354, 0.90037534, 0.96140165, 1.07143380, 1.20495625) T[15, .] = (0.58244320, 0.71865799, 0.75877923, 0.80883355, 0.87990630, 0.93002896, 0.99420311, 1.11072919, 1.25068237) T[16, .] = (0.59374457, 0.73516467, 0.77711768, 0.82906448, 0.90210610, 0.95406021, 1.02076079, 1.13989499, 1.28212575) T[17, .] = (0.60438324, 0.74954535, 0.79294768, 0.84628057, 0.92052887, 0.97274296, 1.04173873, 1.16091523, 1.30363632) T[18, .] = (0.61401230, 0.76206378, 0.80651127, 0.86062824, 0.93559734, 0.98721526, 1.05792481, 1.17570863, 1.31785261) T[19, .] = (0.62225339, 0.77254105, 0.81758723, 0.87219042, 0.94745091, 0.99810172, 1.06993226, 1.18595776, 1.32752358) T[20, .] = (0.62951065, 0.78134057, 0.82681545, 0.88199332, 0.95703653, 1.00704671, 1.07939187, 1.19367227, 1.33439192) T[21, .] = (0.63622133, 0.78907095, 0.83479406, 0.89060884, 0.96503436, 1.01522807, 1.08780432, 1.20123625, 1.34199672) T[22, .] = (0.64215488, 0.79602074, 0.84170529, 0.89803670, 0.97209558, 1.02328431, 1.09632068, 1.21012972, 1.35136826) T[23, .] = (0.64738825, 0.80221619, 0.84784331, 0.90434146, 0.97888108, 1.03127252, 1.10455219, 1.21983642, 1.36203444) T[24, .] = (0.65192570, 0.80770162, 0.85334269, 0.90987683, 0.98539612, 1.03872085, 1.11175467, 1.22832751, 1.37230644) T[25, .] = (0.65609969, 0.81284925, 0.85852451, 0.91517034, 0.99174818, 1.04537620, 1.11774476, 1.23501879, 1.38092904) T[26, .] = (0.66022449, 0.81764277, 0.86355559, 0.92017510, 0.99756297, 1.05103730, 1.12291824, 1.23976729, 1.38623249) T[27, .] = (0.66396421, 0.82190941, 0.86832360, 0.92492810, 1.00263177, 1.05563777, 1.12743645, 1.24321074, 1.38934969) T[28, .] = (0.66703239, 0.82571111, 0.87259574, 0.92941507, 1.00693102, 1.05925596, 1.13135490, 1.24609724, 1.39159331) T[29, .] = (0.66929936, 0.82876321, 0.87577933, 0.93314931, 1.00999369, 1.06178031, 1.13383177, 1.24788661, 1.39112401) T[30, .] = (0.67111761, 0.83105206, 0.87794794, 0.93562621, 1.01205052, 1.06414460, 1.13588480, 1.24947512, 1.38961369) T[31, .] = (0.67298543, 0.83299707, 0.87970322, 0.93726016, 1.01367743, 1.06650575, 1.13777836, 1.25170273, 1.38868676) T[32, .] = (0.67496120, 0.83531644, 0.88194349, 0.93895174, 1.01547330, 1.06873352, 1.13999701, 1.25510818, 1.39044892) T[33, .] = (0.67695389, 0.83778838, 0.88437557, 0.94098924, 1.01731554, 1.07063791, 1.14232123, 1.25846743, 1.39357821) T[34, .] = (0.67911007, 0.84035159, 0.88668908, 0.94320641, 1.01923487, 1.07235375, 1.14426482, 1.26065853, 1.39733009) T[35, .] = (0.68145192, 0.84278901, 0.88897552, 0.94573684, 1.02224878, 1.07501294, 1.14674199, 1.26216202, 1.40082455) T[36, .] = (0.68389653, 0.84506153, 0.89118136, 0.94838695, 1.02594473, 1.07835968, 1.14982057, 1.26354976, 1.40335851) T[37, .] = (0.68628685, 0.84730362, 0.89331317, 0.95089205, 1.02894346, 1.08112525, 1.15188337, 1.26437658, 1.40437280) T[38, .] = (0.68797676, 0.84918715, 0.89497349, 0.95238073, 1.03020050, 1.08211571, 1.15165885, 1.26409545, 1.40329135) T[39, .] = (0.68882055, 0.85036373, 0.89595963, 0.95251858, 1.02946500, 1.08103456, 1.14964021, 1.26254679, 1.40089019) T[40, .] = (0.68931109, 0.85111463, 0.89653830, 0.95240937, 1.02841375, 1.07957774, 1.14835922, 1.26208137, 1.39989825) T[41, .] = (0.68989160, 0.85171321, 0.89714508, 0.95296793, 1.02834477, 1.07945663, 1.14917412, 1.26356574, 1.40115798) T[42, .] = (0.69076733, 0.85213213, 0.89774485, 0.95414179, 1.02940406, 1.08096923, 1.15153084, 1.26567210, 1.40383316) T[43, .] = (0.69176319, 0.85263704, 0.89846854, 0.95565286, 1.03100448, 1.08351634, 1.15414318, 1.26783339, 1.40776167) T[44, .] = (0.69296376, 0.85338311, 0.89964020, 0.95726219, 1.03271288, 1.08626059, 1.15642003, 1.26998680, 1.41259680) T[45, .] = (0.69420438, 0.85448738, 0.90124419, 0.95899563, 1.03481259, 1.08875904, 1.15863802, 1.27222985, 1.41678587) T[46, .] = (0.69538621, 0.85587620, 0.90277825, 0.96035710, 1.03689069, 1.09048861, 1.16005831, 1.27365930, 1.41810348) T[47, .] = (0.69642518, 0.85735682, 0.90390854, 0.96115248, 1.03852742, 1.09136408, 1.16053794, 1.27369475, 1.41717760) T[48, .] = (0.69728015, 0.85848623, 0.90453740, 0.96129994, 1.03917181, 1.09118628, 1.15974121, 1.27259472, 1.41463176) T[49, .] = (0.69828599, 0.85950860, 0.90490710, 0.96133304, 1.03905559, 1.09028926, 1.15780481, 1.27083006, 1.41076025) T[50, .] = (0.69949755, 0.86061304, 0.90510839, 0.96136277, 1.03861608, 1.08923248, 1.15556009, 1.26923224, 1.40668759) T[51, .] = (0.47940833, 0.55251217, 0.57273538, 0.59653238, 0.62915894, 0.65060749, 0.68199568, 0.72924925, 0.78631136) T[52, .] = (0.47800803, 0.54923083, 0.56887732, 0.59241734, 0.62390532, 0.64464207, 0.67458145, 0.72040134, 0.77584570) T[53, .] = (0.47646114, 0.54612593, 0.56519483, 0.58844387, 0.61896617, 0.63903351, 0.66745809, 0.71211335, 0.76587102) T[54, .] = (0.47494263, 0.54358702, 0.56220528, 0.58518636, 0.61502665, 0.63455284, 0.66175903, 0.70570656, 0.75785784) T[55, .] = (0.47404942, 0.54244108, 0.56091436, 0.58386084, 0.61341027, 0.63268899, 0.65939463, 0.70326646, 0.75490020) T[56, .] = (0.47443591, 0.54363681, 0.56233596, 0.58563217, 0.61542846, 0.63495782, 0.66191597, 0.70661067, 0.75976669) T[57, .] = (0.47660311, 0.54776341, 0.56711965, 0.59118076, 0.62189163, 0.64217594, 0.67016976, 0.71657717, 0.77320394) T[58, .] = (0.48045063, 0.55462209, 0.57503296, 0.60025736, 0.63263784, 0.65428237, 0.68411058, 0.73304521, 0.79455673) T[59, .] = (0.48544721, 0.56351183, 0.58526669, 0.61204936, 0.64672180, 0.67057030, 0.70312250, 0.75576535, 0.82354968) T[60, .] = (0.49106885, 0.57336934, 0.59662190, 0.62542985, 0.66300668, 0.68983589, 0.72592285, 0.78367494, 0.85949872) T[61, .] = (0.49703657, 0.58371706, 0.60855883, 0.63971983, 0.68072737, 0.71070978, 0.75082980, 0.81536606, 0.90114726) T[62, .] = (0.50343874, 0.59463343, 0.62106817, 0.65446651, 0.69914118, 0.73188140, 0.77639983, 0.84915591, 0.94589324) T[63, .] = (0.51038956, 0.60614433, 0.63411767, 0.66955070, 0.71772973, 0.75280642, 0.80148885, 0.88258400, 0.99024079) T[64, .] = (0.51781580, 0.61812755, 0.64760375, 0.68489199, 0.73628047, 0.77315639, 0.82550746, 0.91358036, 1.03025965) T[65, .] = (0.52535843, 0.63027503, 0.66114492, 0.70013287, 0.75429145, 0.79224316, 0.84764000, 0.94110901, 1.06425314) T[66, .] = (0.53276176, 0.64201282, 0.67419524, 0.71495624, 0.77148278, 0.81026512, 0.86791132, 0.96505322, 1.09152931) T[67, .] = (0.53983857, 0.65288725, 0.68621088, 0.72888880, 0.78723078, 0.82717841, 0.88645118, 0.98571313, 1.11342417) T[68, .] = (0.54648417, 0.66259963, 0.69692681, 0.74140861, 0.80107486, 0.84215192, 0.90222061, 1.00304873, 1.13122157) T[69, .] = (0.55290016, 0.67128821, 0.70642707, 0.75192511, 0.81276599, 0.85476065, 0.91471081, 1.01726536, 1.14627053) T[70, .] = (0.55909353, 0.67942799, 0.71518999, 0.76077905, 0.82254379, 0.86538781, 0.92513434, 1.02958341, 1.15913264) T[71, .] = (0.56492159, 0.68751605, 0.72375897, 0.76910742, 0.83159372, 0.87512111, 0.93501154, 1.04141665, 1.17062579) T[72, .] = (0.57012932, 0.69516959, 0.73180932, 0.77717998, 0.84012468, 0.88404710, 0.94467554, 1.05317533, 1.18159947) T[73, .] = (0.57473855, 0.70178140, 0.73882942, 0.78466123, 0.84796982, 0.89216156, 0.95359836, 1.06352241, 1.19139751) T[74, .] = (0.57909450, 0.70737887, 0.74497685, 0.79154613, 0.85516032, 0.89974654, 0.96147315, 1.07149703, 1.19979144) T[75, .] = (0.58307731, 0.71202701, 0.75013449, 0.79769119, 0.86163506, 0.90665945, 0.96837686, 1.07662256, 1.20591248) T[76, .] = (0.58665711, 0.71599273, 0.75443933, 0.80284283, 0.86711020, 0.91268619, 0.97407322, 1.07955689, 1.20961655) T[77, .] = (0.58997333, 0.71965077, 0.75804943, 0.80696013, 0.87136639, 0.91734564, 0.97836164, 1.08138223, 1.21221308) T[78, .] = (0.59304361, 0.72305911, 0.76125718, 0.81040936, 0.87474036, 0.92070307, 0.98152791, 1.08274096, 1.21375343) T[79, .] = (0.59573925, 0.72610064, 0.76404036, 0.81317887, 0.87780118, 0.92363014, 0.98463629, 1.08506389, 1.21531012) T[80, .] = (0.59832316, 0.72938544, 0.76711712, 0.81598768, 0.88116144, 0.92689843, 0.98848664, 1.08903716, 1.21696388) T[81, .] = (0.60092279, 0.73291244, 0.77057099, 0.81902276, 0.88478702, 0.93050497, 0.99267094, 1.09342975, 1.22045713) T[82, .] = (0.60367353, 0.73652801, 0.77432360, 0.82231442, 0.88869726, 0.93425563, 0.99660935, 1.09747300, 1.22659324) T[83, .] = (0.60631989, 0.73949076, 0.77772459, 0.82524843, 0.89211423, 0.93765389, 1.00002526, 1.10137226, 1.23269114) T[84, .] = (0.60840723, 0.74149342, 0.78020337, 0.82741649, 0.89448312, 0.94041735, 1.00283193, 1.10505497, 1.23533676) T[85, .] = (0.60986492, 0.74285066, 0.78174985, 0.82872903, 0.89584449, 0.94210154, 1.00503770, 1.10778334, 1.23503826) T[86, .] = (0.61090825, 0.74388492, 0.78286497, 0.82971565, 0.89675326, 0.94290618, 1.00644486, 1.10919792, 1.23404570) T[87, .] = (0.61216117, 0.74521886, 0.78440969, 0.83142239, 0.89827471, 0.94411918, 1.00742689, 1.11044652, 1.23496362) T[88, .] = (0.61365374, 0.74684268, 0.78637626, 0.83380218, 0.90005318, 0.94540942, 1.00780606, 1.11201957, 1.23695674) T[89, .] = (0.61505002, 0.74841710, 0.78808558, 0.83613326, 0.90155057, 0.94650313, 1.00823000, 1.11433555, 1.23919832) T[90, .] = (0.61618063, 0.74976337, 0.78928685, 0.83801074, 0.90281342, 0.94730230, 1.00893755, 1.11642574, 1.24064921) T[91, .] = (0.61725892, 0.75098864, 0.79033753, 0.83939790, 0.90396524, 0.94790376, 1.01001421, 1.11761086, 1.24242093) T[92, .] = (0.61819876, 0.75193055, 0.79113158, 0.83993800, 0.90460760, 0.94816551, 1.01070092, 1.11774512, 1.24494224) T[93, .] = (0.61904062, 0.75266400, 0.79161512, 0.83962947, 0.90468821, 0.94848605, 1.01095444, 1.11706963, 1.24682284) T[94, .] = (0.61997796, 0.75338620, 0.79202622, 0.83922013, 0.90474579, 0.94929328, 1.01130167, 1.11666806, 1.24838959) T[95, .] = (0.62120456, 0.75459005, 0.79305958, 0.84011773, 0.90614327, 0.95133404, 1.01291950, 1.11811180, 1.25137352) T[96, .] = (0.62237272, 0.75565555, 0.79421529, 0.84164966, 0.90794915, 0.95343240, 1.01500710, 1.12072076, 1.25396828) T[97, .] = (0.62309579, 0.75622839, 0.79512471, 0.84307411, 0.90936073, 0.95493355, 1.01682599, 1.12293384, 1.25499727) T[98, .] = (0.62398228, 0.75686034, 0.79614023, 0.84440574, 0.91046224, 0.95587544, 1.01867128, 1.12469052, 1.25540904) T[99, .] = (0.62541992, 0.75784121, 0.79733537, 0.84566624, 0.91133233, 0.95634286, 1.02038997, 1.12562578, 1.25647759) T[100, .] = (0.62710894, 0.75896821, 0.79855284, 0.84683764, 0.91204736, 0.95674530, 1.02214272, 1.12633957, 1.25841045) T[101, .] = (0.46087207, 0.52824022, 0.54719133, 0.57113049, 0.60068004, 0.62075684, 0.64987170, 0.69699540, 0.75195156) T[102, .] = (0.45909646, 0.52593514, 0.54461701, 0.56779933, 0.59747551, 0.61736308, 0.64544778, 0.69048018, 0.74460836) T[103, .] = (0.45751064, 0.52369169, 0.54207106, 0.56459656, 0.59420022, 0.61388129, 0.64095014, 0.68417306, 0.73728546) T[104, .] = (0.45634588, 0.52173712, 0.53986340, 0.56195315, 0.59116722, 0.61063879, 0.63691573, 0.67904784, 0.73089402) T[105, .] = (0.45584790, 0.52071238, 0.53871484, 0.56055324, 0.58929262, 0.60869700, 0.63457691, 0.67682918, 0.72802679) T[106, .] = (0.45624907, 0.52122437, 0.53931209, 0.56106550, 0.58972262, 0.60934130, 0.63539447, 0.67890237, 0.73080702) T[107, .] = (0.45771655, 0.52365502, 0.54213993, 0.56405901, 0.59328653, 0.61342785, 0.64027880, 0.68603874, 0.74032513) T[108, .] = (0.46025343, 0.52804482, 0.54714694, 0.56960580, 0.60003982, 0.62098037, 0.64903957, 0.69769961, 0.75593796) T[109, .] = (0.46358905, 0.53389319, 0.55371971, 0.57726881, 0.60932896, 0.63125779, 0.66105633, 0.71276780, 0.77564458) T[110, .] = (0.46743024, 0.54053433, 0.56113971, 0.58627225, 0.62015725, 0.64335913, 0.67528884, 0.73029923, 0.79779004) T[111, .] = (0.47150019, 0.54733026, 0.56876304, 0.59559525, 0.63127976, 0.65607413, 0.69028041, 0.74907704, 0.82130632) T[112, .] = (0.47562505, 0.55399863, 0.57630300, 0.60461351, 0.64208833, 0.66854629, 0.70515265, 0.76816304, 0.84594746) T[113, .] = (0.47975729, 0.56073108, 0.58400671, 0.61353028, 0.65276649, 0.68075787, 0.71970965, 0.78691724, 0.87174674) T[114, .] = (0.48403296, 0.56796090, 0.59238620, 0.62296221, 0.66394768, 0.69343527, 0.73443855, 0.80580087, 0.89797815) T[115, .] = (0.48839311, 0.57562903, 0.60121869, 0.63277390, 0.67554664, 0.70642281, 0.74919271, 0.82401839, 0.92263040) T[116, .] = (0.49273450, 0.58314005, 0.60977665, 0.64242005, 0.68695494, 0.71890809, 0.76329309, 0.84081071, 0.94486254) T[117, .] = (0.49697169, 0.59021708, 0.61770031, 0.65150236, 0.69764880, 0.73036160, 0.77619966, 0.85613736, 0.96483104) T[118, .] = (0.50117890, 0.59684226, 0.62493001, 0.65985519, 0.70752179, 0.74103793, 0.78777444, 0.86983439, 0.98121151) T[119, .] = (0.50559112, 0.60306580, 0.63167467, 0.66764326, 0.71675859, 0.75136183, 0.79867597, 0.88256148, 0.99405965) T[120, .] = (0.51018183, 0.60907137, 0.63819702, 0.67515088, 0.72554173, 0.76099856, 0.80903969, 0.89419938, 1.00531833) T[121, .] = (0.51478556, 0.61511665, 0.64480288, 0.68269788, 0.73429027, 0.76990681, 0.81919847, 0.90514035, 1.01635348) T[122, .] = (0.51921534, 0.62101726, 0.65130481, 0.68993114, 0.74244315, 0.77797497, 0.82878745, 0.91533613, 1.02693212) T[123, .] = (0.52332745, 0.62663152, 0.65764104, 0.69654995, 0.74952661, 0.78529388, 0.83719181, 0.92489695, 1.03736872) T[124, .] = (0.52691455, 0.63180797, 0.66343240, 0.70229085, 0.75568098, 0.79206913, 0.84425700, 0.93331977, 1.04737989) T[125, .] = (0.53019912, 0.63650651, 0.66850691, 0.70717089, 0.76119670, 0.79845849, 0.85075748, 0.94052053, 1.05529328) T[126, .] = (0.53352055, 0.64091254, 0.67306535, 0.71167623, 0.76626265, 0.80455826, 0.85722350, 0.94660236, 1.06172865) T[127, .] = (0.53690159, 0.64516248, 0.67723917, 0.71610562, 0.77094720, 0.81021488, 0.86287337, 0.95188902, 1.06834122) T[128, .] = (0.53997174, 0.64914470, 0.68111279, 0.72042800, 0.77523131, 0.81492884, 0.86753495, 0.95645126, 1.07373782) T[129, .] = (0.54282518, 0.65300064, 0.68489273, 0.72463279, 0.77905508, 0.81858539, 0.87138702, 0.96012105, 1.07688515) T[130, .] = (0.54558913, 0.65669397, 0.68859378, 0.72863220, 0.78262515, 0.82145277, 0.87482689, 0.96326819, 1.07844228) T[131, .] = (0.54802498, 0.65971625, 0.69173929, 0.73193657, 0.78603867, 0.82398295, 0.87785031, 0.96649843, 1.08029250) T[132, .] = (0.55026265, 0.66217930, 0.69437564, 0.73474848, 0.78942486, 0.82675887, 0.88077181, 0.97038129, 1.08329452) T[133, .] = (0.55227210, 0.66432140, 0.69656287, 0.73736910, 0.79244799, 0.82961789, 0.88346264, 0.97418178, 1.08704979) T[134, .] = (0.55425000, 0.66634951, 0.69863040, 0.73993428, 0.79517573, 0.83270875, 0.88619573, 0.97706295, 1.09159697) T[135, .] = (0.55604356, 0.66814734, 0.70048794, 0.74204998, 0.79768569, 0.83573922, 0.88904707, 0.97925106, 1.09526151) T[136, .] = (0.55754538, 0.66974253, 0.70204102, 0.74358817, 0.79962123, 0.83796178, 0.89153048, 0.98086658, 1.09740188) T[137, .] = (0.55875268, 0.67095830, 0.70306698, 0.74447480, 0.80086233, 0.83899182, 0.89307477, 0.98151348, 1.09894785) T[138, .] = (0.55996723, 0.67214697, 0.70402183, 0.74545639, 0.80189542, 0.83978810, 0.89427793, 0.98194732, 1.10062893) T[139, .] = (0.56123258, 0.67379457, 0.70541443, 0.74714812, 0.80318074, 0.84101829, 0.89609186, 0.98338263, 1.10229804) T[140, .] = (0.56254342, 0.67570828, 0.70717457, 0.74927915, 0.80503370, 0.84317889, 0.89867415, 0.98608856, 1.10461532) T[141, .] = (0.56401439, 0.67743981, 0.70905956, 0.75135982, 0.80749185, 0.84616009, 0.90169820, 0.98960926, 1.10751148) T[142, .] = (0.56559332, 0.67920471, 0.71113740, 0.75329946, 0.81038456, 0.84946393, 0.90461809, 0.99333797, 1.11170473) T[143, .] = (0.56688628, 0.68093984, 0.71318006, 0.75495671, 0.81293895, 0.85217457, 0.90671266, 0.99678347, 1.11578846) T[144, .] = (0.56763861, 0.68233531, 0.71478241, 0.75614599, 0.81449092, 0.85393769, 0.90806342, 0.99900492, 1.11759470) T[145, .] = (0.56816440, 0.68327636, 0.71589934, 0.75695857, 0.81472680, 0.85451765, 0.90840146, 0.99949600, 1.11691692) T[146, .] = (0.56872449, 0.68392768, 0.71685353, 0.75773337, 0.81447402, 0.85442778, 0.90805991, 0.99909158, 1.11579177) T[147, .] = (0.56952592, 0.68485775, 0.71813962, 0.75887672, 0.81476809, 0.85461821, 0.90785397, 0.99826421, 1.11527017) T[148, .] = (0.57051462, 0.68602317, 0.71953382, 0.76022568, 0.81568711, 0.85535172, 0.90823880, 0.99837487, 1.11668361) T[149, .] = (0.57189178, 0.68726803, 0.72096258, 0.76182769, 0.81697055, 0.85635110, 0.90966752, 1.00024434, 1.12050220) T[150, .] = (0.57356467, 0.68855335, 0.72247355, 0.76365818, 0.81836038, 0.85727472, 0.91169147, 1.00294482, 1.12563781) T[151, .] = (0.44387223, 0.50753303, 0.52514014, 0.54657800, 0.57476978, 0.59331922, 0.62119270, 0.66361610, 0.72024494) T[152, .] = (0.44270600, 0.50581237, 0.52318517, 0.54422164, 0.57223184, 0.59082936, 0.61807969, 0.66019994, 0.71347552) T[153, .] = (0.44148887, 0.50393271, 0.52106147, 0.54172304, 0.56938529, 0.58801727, 0.61459437, 0.65590883, 0.70659356) T[154, .] = (0.44044895, 0.50225557, 0.51916177, 0.53950939, 0.56671944, 0.58542392, 0.61131873, 0.65159306, 0.70078403) T[155, .] = (0.43990311, 0.50127350, 0.51804734, 0.53829292, 0.56532614, 0.58418799, 0.60962245, 0.64925258, 0.69830714) T[156, .] = (0.44017322, 0.50163252, 0.51853244, 0.53896121, 0.56618591, 0.58531018, 0.61065208, 0.65066271, 0.70116352) T[157, .] = (0.44136450, 0.50380351, 0.52104724, 0.54194431, 0.56963066, 0.58904600, 0.61500122, 0.65646518, 0.70963775) T[158, .] = (0.44319695, 0.50735468, 0.52503985, 0.54660489, 0.57491327, 0.59473737, 0.62203775, 0.66558848, 0.72195386) T[159, .] = (0.44541800, 0.51141903, 0.52958678, 0.55196463, 0.58107480, 0.60150085, 0.63043180, 0.67624529, 0.73553675) T[160, .] = (0.44777989, 0.51535750, 0.53403647, 0.55724153, 0.58729170, 0.60833774, 0.63874440, 0.68674584, 0.74877339) T[161, .] = (0.45015440, 0.51900143, 0.53828587, 0.56233008, 0.59343178, 0.61502619, 0.64654487, 0.69673831, 0.76192571) T[162, .] = (0.45262316, 0.52265945, 0.54264483, 0.56751982, 0.59970678, 0.62190563, 0.65429195, 0.70675709, 0.77559430) T[163, .] = (0.45545201, 0.52682896, 0.54754253, 0.57312950, 0.60657468, 0.62947788, 0.66268941, 0.71750441, 0.79062550) T[164, .] = (0.45850603, 0.53154146, 0.55289918, 0.57911689, 0.61407905, 0.63789846, 0.67208402, 0.72927623, 0.80654057) T[165, .] = (0.46152473, 0.53650095, 0.55841361, 0.58539263, 0.62192604, 0.64682646, 0.68236702, 0.74195942, 0.82275813) T[166, .] = (0.46441431, 0.54151519, 0.56393320, 0.59188769, 0.62999288, 0.65608140, 0.69313092, 0.75501886, 0.83839364) T[167, .] = (0.46728013, 0.54658456, 0.56942914, 0.59831682, 0.63796151, 0.66523950, 0.70344666, 0.76758570, 0.85301845) T[168, .] = (0.47031504, 0.55169565, 0.57493508, 0.60451415, 0.64550471, 0.67369728, 0.71237106, 0.77860265, 0.86619907) T[169, .] = (0.47360601, 0.55686582, 0.58051834, 0.61054675, 0.65252321, 0.68134203, 0.72017755, 0.78824595, 0.87864046) T[170, .] = (0.47710227, 0.56213485, 0.58623321, 0.61672721, 0.65927416, 0.68847623, 0.72769318, 0.79748038, 0.89131281) T[171, .] = (0.48064656, 0.56736471, 0.59194243, 0.62304798, 0.66593660, 0.69533647, 0.73526617, 0.80682466, 0.90419156) T[172, .] = (0.48379755, 0.57198380, 0.59710238, 0.62894434, 0.67206925, 0.70170151, 0.74250865, 0.81538016, 0.91434418) T[173, .] = (0.48648097, 0.57586638, 0.60155191, 0.63400915, 0.67758104, 0.70774858, 0.74942681, 0.82299367, 0.92253042) T[174, .] = (0.48897258, 0.57946705, 0.60562766, 0.63842908, 0.68261225, 0.71367220, 0.75615427, 0.82994912, 0.93021412) T[175, .] = (0.49151131, 0.58296130, 0.60955467, 0.64242499, 0.68711591, 0.71925630, 0.76271192, 0.83699180, 0.93744063) T[176, .] = (0.49422287, 0.58641753, 0.61343227, 0.64638841, 0.69154318, 0.72457518, 0.76920794, 0.84432163, 0.94424962) T[177, .] = (0.49707439, 0.58993597, 0.61729400, 0.65047844, 0.69616018, 0.72969109, 0.77519576, 0.85081765, 0.94979879) T[178, .] = (0.49991280, 0.59367069, 0.62129117, 0.65475753, 0.70076303, 0.73426379, 0.77990888, 0.85638086, 0.95460524) T[179, .] = (0.50256372, 0.59737343, 0.62519460, 0.65881239, 0.70488441, 0.73800053, 0.78336150, 0.86118269, 0.95930667) T[180, .] = (0.50496781, 0.60065309, 0.62860856, 0.66230016, 0.70826802, 0.74080468, 0.78606096, 0.86523812, 0.96377537) T[181, .] = (0.50711737, 0.60338167, 0.63134550, 0.66520540, 0.71101140, 0.74323987, 0.78884547, 0.86876438, 0.96840008) T[182, .] = (0.50905892, 0.60565705, 0.63358461, 0.66797647, 0.71380261, 0.74599189, 0.79219653, 0.87183301, 0.97266823) T[183, .] = (0.51092865, 0.60764289, 0.63553972, 0.67078326, 0.71711246, 0.74927235, 0.79633520, 0.87524327, 0.97606934) T[184, .] = (0.51274001, 0.60952255, 0.63749644, 0.67361614, 0.72079626, 0.75288958, 0.80076450, 0.87905038, 0.97993294) T[185, .] = (0.51444551, 0.61137184, 0.63946857, 0.67608699, 0.72406643, 0.75630457, 0.80444370, 0.88264719, 0.98390627) T[186, .] = (0.51601258, 0.61320634, 0.64137372, 0.67794430, 0.72643327, 0.75894450, 0.80660240, 0.88459158, 0.98615644) T[187, .] = (0.51748264, 0.61507190, 0.64335430, 0.67963318, 0.72835626, 0.76090608, 0.80779277, 0.88521554, 0.98642339) T[188, .] = (0.51884548, 0.61674641, 0.64523891, 0.68120498, 0.72997499, 0.76235763, 0.80855708, 0.88580170, 0.98567156) T[189, .] = (0.52011213, 0.61833658, 0.64692046, 0.68255817, 0.73144504, 0.76373114, 0.80938458, 0.88639208, 0.98377274) T[190, .] = (0.52143487, 0.62000808, 0.64854184, 0.68385927, 0.73293598, 0.76536729, 0.81073526, 0.88717895, 0.98221872) T[191, .] = (0.52280482, 0.62149187, 0.64993527, 0.68502713, 0.73408777, 0.76692842, 0.81232508, 0.88898011, 0.98305808) T[192, .] = (0.52409303, 0.62267627, 0.65106897, 0.68612669, 0.73482635, 0.76800542, 0.81359863, 0.89166274, 0.98637820) T[193, .] = (0.52527497, 0.62404523, 0.65235893, 0.68760135, 0.73601219, 0.76929896, 0.81525978, 0.89516487, 0.99147954) T[194, .] = (0.52642894, 0.62567548, 0.65387314, 0.68938401, 0.73790062, 0.77127568, 0.81760081, 0.89805453, 0.99671998) T[195, .] = (0.52743588, 0.62736166, 0.65532913, 0.69102416, 0.73981933, 0.77340444, 0.82023301, 0.89981751, 1.00057947) T[196, .] = (0.52823798, 0.62878741, 0.65664538, 0.69242820, 0.74154653, 0.77542893, 0.82288369, 0.90098138, 1.00287699) T[197, .] = (0.52904344, 0.62997686, 0.65801897, 0.69379696, 0.74319126, 0.77723828, 0.82525610, 0.90266087, 1.00497681) T[198, .] = (0.52996937, 0.63092197, 0.65935790, 0.69503272, 0.74444677, 0.77841600, 0.82668085, 0.90437741, 1.00699823) T[199, .] = (0.53085726, 0.63180687, 0.66057535, 0.69597409, 0.74515410, 0.77848883, 0.82649257, 0.90521840, 1.00867002) T[200, .] = (0.53167871, 0.63265809, 0.66163585, 0.69657033, 0.74537133, 0.77764954, 0.82498146, 0.90495665, 1.00975788) return(T) } // ============================================================================ // Structures // ============================================================================ struct _fcusum_fit { real scalar stat, omega2, lags, nobs real colvector u, b } struct _fcusum_core { real scalar khat, statf, statp, F, n, nobs, om0, L0 real colvector b0, u0, tt real rowvector grid struct _fcusum_fit scalar f1 } // ============================================================================ // Building blocks (mirror R/internal.R and R/lrv.R of FCUSUM 1.1.0) // ============================================================================ // DOLS design: constant, levels of x, q leads and lags of D.x. // Estimation sample is (trim + 2) .. (n - trim). void _fcusum_dols(real colvector y, real matrix X, real scalar q, real scalar trim, real colvector yy, real matrix Z, real colvector tt) { real scalar n, p, l real matrix dx n = rows(y) p = cols(X) dx = J(1, p, .) \ (X[|2, 1 \ n, p|] - X[|1, 1 \ n - 1, p|]) tt = (trim + 2 :: n - trim) yy = y[tt] Z = J(rows(tt), 1, 1), X[tt, .] for (l = -q; l <= q; l++) Z = Z, dx[tt :+ l, .] } // OLS residuals (QR based) real matrix _fcusum_res(real matrix Z, real matrix Y) { return(Y - Z * qrsolve(Z, Y)) } // Number of DOLS leads/lags by BIC on a common sample real scalar _fcusum_selq(real colvector y, real matrix X, real scalar qmax) { real scalar q, m, bic, best, qbest real colvector yy, tt, e real matrix Z best = . qbest = 0 for (q = 0; q <= qmax; q++) { _fcusum_dols(y, X, q, qmax, yy, Z, tt) m = rows(yy) if (m - cols(Z) < 1) continue e = _fcusum_res(Z, yy) bic = m * ln(sum(e:^2) / m) + cols(Z) * ln(m) if (bic < best) { best = bic qbest = q } } return(qbest) } // Frequency grid real rowvector _fcusum_grid(real scalar kstar, string scalar freq, real scalar step) { real scalar K if (freq == "integer") return(1..kstar) K = floor((kstar - 0.1) / step + 1e-10) return(round(0.1 :+ step :* (0..K), 1e-10)) } // RSS of yy ~ Z + cos(2 pi k t/n) + sin(2 pi k t/n) for every k in grid // (Frisch-Waugh-Lovell, one QR decomposition) real rowvector _fcusum_fsearch(real colvector yy, real matrix Z, real colvector tt, real scalar n, real rowvector grid) { real scalar G, j real matrix arg, R, RC, RS real colvector ey real rowvector a, b, d, g1, g2, dt, ess, rss G = cols(grid) arg = (2 * pi() / n) :* (tt * grid) R = _fcusum_res(Z, (yy, cos(arg), sin(arg))) ey = R[., 1] RC = R[|1, 2 \ rows(R), G + 1|] RS = R[|1, G + 2 \ rows(R), 2 * G + 1|] a = colsum(RC:^2) b = colsum(RC :* RS) d = colsum(RS:^2) g1 = colsum(RC :* ey) g2 = colsum(RS :* ey) dt = a :* d - b:^2 ess = (d :* g1:^2 - 2 :* b :* g1 :* g2 + a :* g2:^2) :/ dt rss = sum(ey:^2) :- ess for (j = 1; j <= G; j++) { if (rss[j] >= . | dt[j] <= 1e-10 * a[j] * d[j]) rss[j] = maxdouble() } return(rss) } // Index of the first minimum real scalar _fcusum_argmin(real rowvector v) { real scalar j, jb jb = 1 for (j = 2; j <= cols(v); j++) if (v[j] < v[jb]) jb = j return(jb) } real scalar _fcusum_andS(real scalar r, real scalar n) { return(1.1447 * (4 * r^2 * n / ((1 + r)^2 * (1 - r)^2))^(1 / 3)) } // Bartlett long-run variance; returns (omega2, lags) real rowvector _fcusum_lrv(real colvector u0, string scalar bw) { real scalar n, S, rho, L, s, l real colvector u u = u0 :- mean(u0) n = rows(u) if (bw == "nw") { S = 4 * (n / 100)^(2 / 9) } else { rho = sum(u[|2 \ n|] :* u[|1 \ n - 1|]) / sum(u[|1 \ n - 1|]:^2) if (bw == "andrews") { rho = max((min((rho, 0.97)), -0.97)) S = _fcusum_andS(rho, n) } else { rho = max((min((rho, 0.999)), -0.999)) S = min((_fcusum_andS(rho, n), _fcusum_andS(0.7, n))) } } L = floor(S) if (L > n - 2) L = n - 2 s = sum(u:^2) / n for (l = 1; l <= L; l++) { s = s + 2 * (1 - l / (L + 1)) * sum(u[|l + 1 \ n|] :* u[|1 \ n - l|]) / n } if (s < epsilon(1)) s = epsilon(1) return((s, L)) } real scalar _fcusum_cusum(real colvector u, real scalar omega2) { return(max(abs(runningsum(u))) / (sqrt(omega2) * sqrt(rows(u)))) } // DOLS with the Fourier pair at frequency k, and its CUSUM statistic struct _fcusum_fit scalar _fcusum_fitk(real colvector yy, real matrix Z, real colvector tt, real scalar n, real scalar k, string scalar bw) { struct _fcusum_fit scalar f real matrix X real rowvector lv X = Z, cos(2 * pi() * k :* tt / n), sin(2 * pi() * k :* tt / n) f.b = qrsolve(X, yy) f.u = yy - X * f.b lv = _fcusum_lrv(f.u, bw) f.omega2 = lv[1] f.lags = lv[2] f.nobs = rows(f.u) f.stat = _fcusum_cusum(f.u, f.omega2) return(f) } // Full procedure on one sample struct _fcusum_core scalar _fcusum_runcore(real colvector y, real matrix X, real scalar q, string scalar bw, real rowvector grid) { struct _fcusum_core scalar c real colvector yy, tt real matrix Z real rowvector rss, lv c.n = rows(y) c.grid = grid _fcusum_dols(y, X, q, q, yy, Z, tt) c.tt = tt rss = _fcusum_fsearch(yy, Z, tt, c.n, grid) c.khat = grid[_fcusum_argmin(rss)] c.f1 = _fcusum_fitk(yy, Z, tt, c.n, c.khat, bw) c.b0 = qrsolve(Z, yy) c.u0 = yy - Z * c.b0 c.nobs = rows(c.u0) lv = _fcusum_lrv(c.u0, bw) c.om0 = lv[1] c.L0 = lv[2] c.statp = _fcusum_cusum(c.u0, c.om0) c.statf = c.f1.stat c.F = ((sum(c.u0:^2) - sum(c.f1.u:^2)) / 2) / c.f1.omega2 return(c) } // p independent Gaussian random walks real matrix _fcusum_rw(real scalar n, real scalar p) { real matrix X real scalar j X = rnormal(n, p, 0, 1) for (j = 1; j <= p; j++) X[., j] = runningsum(X[., j]) return(X) } // ============================================================================ // Bootstrap and simulation (mirror .boot_fourier and fcum_cv_sim) // ============================================================================ // AR(m) by OLS with intercept on demeaned data, m = 0..pmax chosen by AIC // (as stats::ar(method = "ols", aic = TRUE, demean = TRUE)). // Returns the AR coefficients (possibly empty); residuals in e. real rowvector _fcusum_arfit(real colvector u, real scalar pmax, real colvector e) { real scalar n, m, j, aic, best real colvector x, Y, bm, E real matrix Xm real rowvector phi x = u :- mean(u) n = rows(x) best = . phi = J(1, 0, .) for (m = 0; m <= pmax; m++) { Y = x[|m + 1 \ n|] Xm = J(n - m, 1, 1) for (j = 1; j <= m; j++) Xm = Xm, x[|m + 1 - j \ n - j|] bm = qrsolve(Xm, Y) E = Y - Xm * bm aic = n * ln(sum(E:^2) / (n - m)) + 2 * (m + 1) if (aic < best) { best = aic e = E if (m > 0) phi = bm[|2 \ m + 1|]' else phi = J(1, 0, .) } } return(phi) } real colvector _fcusum_boot(struct _fcusum_core scalar c, real scalar p, real scalar q, string scalar bw, real scalar B, string scalar type) { real scalar n, sc, nb, a1, a2, k, b, t, j, burn, ne real colvector tt, brk, e, draws, u, eb, yy, ttb, ys real rowvector phi, rss real matrix X, Z complex rowvector rt struct _fcusum_fit scalar fb n = c.n tt = (1 :: n) sc = sqrt(c.f1.omega2) nb = rows(c.f1.b) a1 = c.f1.b[nb - 1] / sc a2 = c.f1.b[nb] / sc k = c.khat brk = a1 :* cos(2 * pi() * k :* tt / n) + a2 :* sin(2 * pi() * k :* tt / n) burn = 50 if (type == "sieve") { phi = _fcusum_arfit(c.f1.u, 4, e) if (cols(phi)) { if (sum(phi) > 0.9) phi = phi :* (0.9 / sum(phi)) rt = polyroots((1, -phi)) if (any(abs(rt) :< 1.02)) phi = J(1, 0, .) } e = (e :- mean(e)) :/ sc ne = rows(e) } draws = J(B, 1, .) for (b = 1; b <= B; b++) { X = _fcusum_rw(n, p) if (type == "iid") { u = rnormal(n, 1, 0, 1) } else { eb = e[floor(runiform(n + burn, 1) :* ne) :+ 1] u = eb for (t = 2; t <= n + burn; t++) { for (j = 1; j <= cols(phi); j++) { if (t - j >= 1) u[t] = u[t] + phi[j] * u[t - j] } } u = u[|burn + 1 \ n + burn|] } ys = brk + u _fcusum_dols(ys, X, q, q, yy, Z, ttb) rss = _fcusum_fsearch(yy, Z, ttb, n, c.grid) fb = _fcusum_fitk(yy, Z, ttb, n, c.grid[_fcusum_argmin(rss)], bw) draws[b] = fb.stat } return(draws) } // Null distribution under cointegration without break // type "plain": Xiao-Phillips CUSUM; "supF": sup-F; "fixed": Fourier CUSUM at k real colvector _fcusum_sim(real scalar n, real scalar p, string scalar type, real scalar k, real rowvector grid, real scalar q, string scalar bw, real scalar nsim) { real scalar i real colvector draws, y, yy, tt, u real rowvector lv real matrix X, Z struct _fcusum_fit scalar f struct _fcusum_core scalar c draws = J(nsim, 1, .) for (i = 1; i <= nsim; i++) { X = _fcusum_rw(n, p) y = rnormal(n, 1, 0, 1) if (type == "fixed") { _fcusum_dols(y, X, q, q, yy, Z, tt) f = _fcusum_fitk(yy, Z, tt, n, k, bw) draws[i] = f.stat } else if (type == "plain") { _fcusum_dols(y, X, q, q, yy, Z, tt) u = _fcusum_res(Z, yy) lv = _fcusum_lrv(u, bw) draws[i] = _fcusum_cusum(u, lv[1]) } else { c = _fcusum_runcore(y, X, q, bw, grid) draws[i] = c.F } } return(draws) } // ============================================================================ // Critical values and p-values (mirror R/critical_values.R) // ============================================================================ // Linear interpolation of yv(xv) at x0, constant outside (approx(rule = 2)) real scalar _fcusum_interp(real vector xv, real vector yv, real scalar x0) { real scalar j, n n = length(xv) if (x0 <= xv[1]) return(yv[1]) if (x0 >= xv[n]) return(yv[n]) for (j = 1; j < n; j++) { if (x0 <= xv[j + 1]) { return(yv[j] + (yv[j + 1] - yv[j]) * (x0 - xv[j]) / (xv[j + 1] - xv[j])) } } return(yv[n]) } // Quantile, R type 7 real scalar _fcusum_q7(real colvector x, real scalar pr) { real colvector s real scalar h, lo s = sort(x, 1) h = (rows(s) - 1) * pr + 1 lo = floor(h) if (lo >= rows(s)) return(s[rows(s)]) return(s[lo] + (h - lo) * (s[lo + 1] - s[lo])) } // From tabulated quantiles: cv = (10%, 5%, 1%), p-value, label void _fcusum_cvtab(real scalar stat, real rowvector qv, real rowvector cv, real scalar pv, string scalar plab) { real rowvector pr pr = _fcusum_probs() cv = (qv[5], qv[7], qv[9]) if (stat >= max(qv)) { pv = 1 - max(pr) plab = "< " + strofreal(pv, "%4.2f") } else if (stat <= min(qv)) { pv = 1 - min(pr) plab = "> " + strofreal(pv, "%4.2f") } else { pv = 1 - _fcusum_interp(qv, pr, stat) plab = strofreal(round(pv, 0.001), "%5.3f") } } // From simulated / bootstrap draws void _fcusum_cvdraws(real scalar stat, real colvector dr, real rowvector cv, real scalar pv, string scalar plab) { cv = (_fcusum_q7(dr, 0.90), _fcusum_q7(dr, 0.95), _fcusum_q7(dr, 0.99)) pv = (1 + sum(dr :>= stat)) / (rows(dr) + 1) plab = strofreal(pv, "%5.3f") } // Fixed-frequency table row interpolated in k (p <= 4, 0.1 <= k <= 5) real rowvector _fcusum_fixedq(real scalar p, real scalar k) { real matrix T real colvector kk real rowvector out real scalar j T = _fcusum_tab_fixed() T = T[|50 * (p - 1) + 1, 1 \ 50 * p, 9|] kk = (1 :: 50) :/ 10 out = J(1, 9, .) for (j = 1; j <= 9; j++) out[j] = _fcusum_interp(kk, T[., j], k) return(out) } // ============================================================================ // Main entry point called by fcusum.ado // ============================================================================ void _fcusum_main(string scalar yname, string scalar xvars, string scalar xlabels, string scalar touse, real scalar kstar, string scalar freq, string scalar fourier, real scalar plevel, string scalar cvtype, string scalar boot, real scalar reps, real scalar q, real scalar qmax, string scalar bw, real scalar step, string scalar rvar, string scalar pvar, string scalar bname) { real colvector y, yy, tt, dr, u, obs, b real matrix X, Z real scalar n, p, usef, stat, pv, Fpv, cvlev, om, L, m, nb real rowvector grid, cv, Fcv, qrow real matrix TT string scalar plab, Fplab, test, cvsrc, dec, stars string rowvector xl, cn struct _fcusum_core scalar c y = st_data(., yname, touse) X = st_data(., tokens(xvars), touse) xl = tokens(xlabels) n = rows(y) p = cols(X) if (qmax < 0) qmax = min((4, floor(4 * (n / 100)^(1 / 4)))) // ---- step 1: DOLS + frequency search ------------------------------------ if (q < 0) q = _fcusum_selq(y, X, qmax) _fcusum_dols(y, X, q, q, yy, Z, tt) if (rows(yy) - cols(Z) - 2 < 10) { errprintf("too few observations for %g regressor(s) and q = %g leads/lags\n", p, q) exit(2001) } grid = _fcusum_grid(kstar, freq, step) c = _fcusum_runcore(y, X, q, bw, grid) // ---- step 2: sup-F pre-test --------------------------------------------- if (p <= 4 & kstar <= 5 & (freq == "integer" | abs(step - 0.01) < 1e-12)) { TT = _fcusum_tab_supf() qrow = TT[20 * (freq == "integer") + 4 * (kstar - 1) + p, .] _fcusum_cvtab(c.F, qrow, Fcv, Fpv, Fplab) cvlev = _fcusum_interp(_fcusum_probs(), qrow, 1 - plevel) } else { printf("{txt}sup-F critical values not tabulated for this configuration; simulating (%g reps).\n", reps) dr = _fcusum_sim(n, p, "supF", 1, grid, q, bw, reps) _fcusum_cvdraws(c.F, dr, Fcv, Fpv, Fplab) cvlev = _fcusum_q7(dr, 1 - plevel) } if (fourier == "auto") usef = (c.F > cvlev) else if (fourier == "always") usef = 1 else usef = 0 // ---- step 3: CUSUM test --------------------------------------------------- if (usef) { test = "Fourier CUSUM" stat = c.statf if (cvtype == "bootstrap") { dr = _fcusum_boot(c, p, q, bw, reps, boot) _fcusum_cvdraws(stat, dr, cv, pv, plab) cvsrc = boot + " bootstrap, " + strofreal(reps) + " reps" } else if (p <= 4 & c.khat >= 0.1 & c.khat <= 5) { _fcusum_cvtab(stat, _fcusum_fixedq(p, c.khat), cv, pv, plab) cvsrc = "asymptotic table, fixed frequency" } else { printf("{txt}Outside the fixed-frequency table; simulating (%g reps).\n", reps) dr = _fcusum_sim(n, p, "fixed", c.khat, grid, q, bw, reps) _fcusum_cvdraws(stat, dr, cv, pv, plab) cvsrc = "simulated, fixed frequency" } u = c.f1.u b = c.f1.b om = c.f1.omega2 L = c.f1.lags } else { test = "Xiao-Phillips CUSUM" stat = c.statp if (p <= 4) { TT = _fcusum_tab_plain() qrow = TT[p, .] _fcusum_cvtab(stat, qrow, cv, pv, plab) cvsrc = "asymptotic table" } else { printf("{txt}Plain CUSUM table covers p <= 4; simulating (%g reps).\n", reps) dr = _fcusum_sim(n, p, "plain", 1, grid, q, bw, reps) _fcusum_cvdraws(stat, dr, cv, pv, plab) cvsrc = "simulated" } u = c.u0 b = c.b0 om = c.om0 L = c.L0 } if (stat > cv[3]) { dec = "Reject H0 (cointegration) at the 1% level" stars = "***" } else if (stat > cv[2]) { dec = "Reject H0 (cointegration) at the 5% level" stars = "**" } else if (stat > cv[1]) { dec = "Reject H0 (cointegration) at the 10% level" stars = "*" } else { dec = "Fail to reject H0: evidence of cointegration" stars = "" } // ---- variables: residuals and scaled CUSUM path ----------------------------- m = rows(u) obs = selectindex(st_data(., touse)) obs = obs[c.tt] st_store(obs, rvar, u) st_store(obs, pvar, runningsum(u) / (sqrt(om) * sqrt(m))) // ---- coefficients: constant, levels of x, Fourier pair ------------------------ nb = 1 + p cn = ("_cons", xl) if (usef) { st_matrix(bname, (b[|1 \ nb|] \ b[|rows(b) - 1 \ rows(b)|])') cn = cn, ("cos_k", "sin_k") } else { st_matrix(bname, b[|1 \ nb|]') } st_matrixcolstripe(bname, (J(cols(cn), 1, ""), cn')) st_matrixrowstripe(bname, ("", "coef")) // ---- locals for the ado-file ------------------------------------------------ st_local("test", test) st_local("stat", strofreal(stat, "%21.0g")) st_local("pval", strofreal(pv, "%21.0g")) st_local("plab", plab) st_local("cv10", strofreal(cv[1], "%21.0g")) st_local("cv5", strofreal(cv[2], "%21.0g")) st_local("cv1", strofreal(cv[3], "%21.0g")) st_local("cvsrc", cvsrc) st_local("decision", dec) st_local("stars", stars) st_local("supf", strofreal(c.F, "%21.0g")) st_local("supf_p", strofreal(Fpv, "%21.0g")) st_local("supf_plab", Fplab) st_local("supf_cvl", strofreal(cvlev, "%21.0g")) st_local("supf_cv10", strofreal(Fcv[1], "%21.0g")) st_local("supf_cv5", strofreal(Fcv[2], "%21.0g")) st_local("supf_cv1", strofreal(Fcv[3], "%21.0g")) st_local("fret", strofreal(usef)) st_local("khat", strofreal(c.khat, "%21.0g")) st_local("statf", strofreal(c.statf, "%21.0g")) st_local("statp", strofreal(c.statp, "%21.0g")) st_local("qsel", strofreal(q)) st_local("nobs", strofreal(m)) st_local("lrv", strofreal(om, "%21.0g")) st_local("bwlags", strofreal(L)) } end