------------------------------------------------------------------------------------------------------------------------ name: handoff log: /Users/tylersotomayor/local-projections-course/practica/p01-question-to-projection/lab-project/output/hando > ff-check.log log type: text opened on: 13 Sep 2026, 22:49:11 . global LP_STEP handoff . . local rec "handoff/l01-explorer-handoff.json" . capture confirm file "`rec'" . if _rc { . display as text "No handoff record in handoff/. Download l01-explorer-handoff.json from the Explorer to check it." . log close handoff . exit . } . . tempname T . postfile `T' str6 lab str44 quantity double(browser stata difference) str44 result /// > using "output/handoff-check.dta", replace (file output/handoff-check.dta not found) . . * A value of null in the record means the browser had no finite number. . capture program drop _lp_num . program define _lp_num, rclass 1. args text 2. if inlist(`"`text'"', "", "null") return scalar x = . 3. else return scalar x = `text' 4. end . . lp_json_get using "`rec'", key(lecture) . local lecture "`r(value)'" . lp_assert "Handoff: the record comes from the Lecture 01 Explorer" : "`lecture'" == "01" pass Handoff: the record comes from the Lecture 01 Explorer . . *========================================================================== . * Lab 2: the rows of the horizon-h regression in the hand table . *========================================================================== . lp_json_get using "`rec'", key(lab2.settings.h) . local h2 = `r(value)' . lp_json_get using "`rec'", key(lab2.settings.control_y_lag) . local ctl2 = ("`r(value)'" == "true") . lp_json_get using "`rec'", key(lab2.settings.single_episode) . local one2 = ("`r(value)'" == "true") . lp_json_get using "`rec'", key(lab2.T_h) . local Th2 = `r(value)' . lp_json_get using "`rec'", key(lab2.beta_h) . _lp_num "`r(value)'" . local b2 = r(x) . display as text _n "Lab 2 record: h = `h2', control = `ctl2', single episode = `one2', T_h = `Th2', slope = `b2'" Lab 2 record: h = 2, control = 0, single episode = 0, T_h = 9, slope = 2.050024 . . local hand "data/raw/hand_table.csv" . capture confirm file "handoff/hand_table.csv" . if _rc == 0 { . import delimited using "handoff/hand_table.csv", clear (encoding automatically selected: ISO-8859-2) (4 vars, 12 obs) . rename (s v y) (s_b v_b y_b) . tempfile browser . save `browser' file /var/folders/bk/6srdc2qx62b56c7594wqt1yw0000gn/T//St53173.000001 saved as .dta format . import delimited using "data/raw/hand_table.csv", clear (encoding automatically selected: ISO-8859-2) (4 vars, 12 obs) . merge 1:1 t using `browser', nogenerate Result Number of obs ----------------------------------------- Not matched 0 Matched 12 ----------------------------------------- . lp_assert "Handoff Lab 2: handoff/hand_table.csv holds the shipped observations" : /// > abs(s - s_b) < 1e-7 & abs(v - v_b) < 1e-7 & abs(y - y_b) < 1e-7 pass Handoff Lab 2: handoff/hand_table.csv holds the shipped observations . lp_sha256 "handoff/hand_table.csv" . local sha_b "`r(sha256)'" . lp_sha256 "data/raw/hand_table.csv" . display as text "SHA-256 of the browser export " cond("`sha_b'" == "`r(sha256)'", "equals", "differs from") " the > shipped file." SHA-256 of the browser export equals the shipped file. . local hand "handoff/hand_table.csv" . } . import delimited using "`hand'", clear (encoding automatically selected: ISO-8859-2) (4 vars, 12 obs) . tsset t Time variable: t, 1 to 12 Delta: 1 unit . local regressor "s" . if `one2' { . generate byte s_one = (t == 5) . local regressor "s_one" . } . local control = cond(`ctl2', "L.y", "") . display as text "regress F`h2'.y `regressor' `control' if t >= 2" regress F2.y s if t >= 2 . regress F`h2'.y `regressor' `control' if t >= 2 Source | SS df MS Number of obs = 9 -------------+---------------------------------- F(1, 7) = 10.27 Model | 6.53737764 1 6.53737764 Prob > F = 0.0150 Residual | 4.45472039 7 .636388627 R-squared = 0.5947 -------------+---------------------------------- Adj R-squared = 0.5368 Total | 10.992098 8 1.37401225 Root MSE = .79774 ------------------------------------------------------------------------------ F2.y | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- s | 2.050024 .6396147 3.21 0.015 .5375759 3.562473 _cons | .2325195 .3015173 0.77 0.466 -.4804555 .9454946 ------------------------------------------------------------------------------ . lp_assert "Handoff Lab 2: `Th2' rows at h = `h2', as in the browser" : e(N) == `Th2' pass Handoff Lab 2: 9 rows at h = 2, as in the browser . local b2s = _b[`regressor'] . lp_close `b2s' `b2', tol(1e-6) label(Handoff Lab 2: the slope at h = `h2' against the browser) Handoff Lab 2: the slope at h = 2 against the browser value 2.05002437 target 2.05002400 |diff| 3.69e-07 tol 1.0e-06 pass Handoff Lab 2: the slope at h = 2 against the browser . post `T' ("Lab 2") ("slope at h = `h2'") (`b2') (`b2s') (`b2s' - `b2') ("agrees within 1e-6") . . *========================================================================== . * Lab 3: thirteen local projections on the recorded draw . *========================================================================== . lp_json_get using "`rec'", key(lab3.settings.rho) . local rho3 "`r(value)'" . lp_json_get using "`rec'", key(lab3.settings.T) . local T3 = `r(value)' . lp_json_get using "`rec'", key(lab3.settings.control_y_lag) . local ctl3 = ("`r(value)'" == "true") . lp_json_get using "`rec'", key(lab3.file) . local file3 "`r(value)'" . lp_json_get using "`rec'", key(lab3.beta_h) . local b3 "`r(value)'" . local nb3 = r(n) . lp_json_get using "`rec'", key(lab3.T_h) . local n3 "`r(value)'" . display as text _n "Lab 3 record: rho = `rho3', T = `T3', control = `ctl3', file `file3'" Lab 3 record: rho = 0.9, T = 200, control = 1, file onedraw_rho09_seed2.csv . lp_assert "Handoff Lab 3: the record names one of the two shipped draws" : /// > inlist("`file3'", "onedraw_rho09_seed2.csv", "onedraw_rho05_seed2.csv") pass Handoff Lab 3: the record names one of the two shipped draws . lp_assert "Handoff Lab 3: thirteen browser estimates" : `nb3' == 13 pass Handoff Lab 3: thirteen browser estimates . . local draw "data/raw/`file3'" . capture confirm file "handoff/`file3'" . if _rc == 0 { . import delimited using "handoff/`file3'", clear (encoding automatically selected: ISO-8859-2) (4 vars, 200 obs) . rename (s v y) (s_b v_b y_b) . tempfile browser . save `browser' file /var/folders/bk/6srdc2qx62b56c7594wqt1yw0000gn/T//St53173.000002 saved as .dta format . import delimited using "data/raw/`file3'", clear (encoding automatically selected: ISO-8859-2) (4 vars, 200 obs) . merge 1:1 t using `browser', nogenerate Result Number of obs ----------------------------------------- Not matched 0 Matched 200 ----------------------------------------- . lp_assert "Handoff Lab 3: handoff/`file3' holds the shipped observations" : /// > abs(s - s_b) < 1e-7 & abs(v - v_b) < 1e-7 & abs(y - y_b) < 1e-7 pass Handoff Lab 3: handoff/onedraw_rho09_seed2.csv holds the shipped observations . local draw "handoff/`file3'" . } . import delimited using "`draw'", clear (encoding automatically selected: ISO-8859-2) (4 vars, 200 obs) . tsset t Time variable: t, 1 to 200 Delta: 1 unit . keep if t <= `T3' (0 observations deleted) . local control = cond(`ctl3', "L.y", "") . forvalues h = 0/12 { 2. local i = `h' + 1 3. local bb : word `i' of `b3' 4. local nn : word `i' of `n3' 5. _lp_num "`bb'" 6. local bb = r(x) 7. quietly regress F`h'.y s `control' 8. lp_assert "Handoff Lab 3: `nn' rows at h = `h'" : e(N) == `nn' 9. local bs = _b[s] 10. lp_close `bs' `bb', tol(1e-6) label(Handoff Lab 3: the slope at h = `h' against the browser) 11. post `T' ("Lab 3") ("slope at h = `h'") (`bb') (`bs') (`bs' - `bb') ("agrees within 1e-6") 12. } pass Handoff Lab 3: 199 rows at h = 0 Handoff Lab 3: the slope at h = 0 against the browser value 0.87894028 target 0.87894000 |diff| 2.81e-07 tol 1.0e-06 pass Handoff Lab 3: the slope at h = 0 against the browser pass Handoff Lab 3: 198 rows at h = 1 Handoff Lab 3: the slope at h = 1 against the browser value 0.85326038 target 0.85326000 |diff| 3.78e-07 tol 1.0e-06 pass Handoff Lab 3: the slope at h = 1 against the browser pass Handoff Lab 3: 197 rows at h = 2 Handoff Lab 3: the slope at h = 2 against the browser value 0.61273705 target 0.61273700 |diff| 4.55e-08 tol 1.0e-06 pass Handoff Lab 3: the slope at h = 2 against the browser pass Handoff Lab 3: 196 rows at h = 3 Handoff Lab 3: the slope at h = 3 against the browser value 0.61104632 target 0.61104600 |diff| 3.24e-07 tol 1.0e-06 pass Handoff Lab 3: the slope at h = 3 against the browser pass Handoff Lab 3: 195 rows at h = 4 Handoff Lab 3: the slope at h = 4 against the browser value 0.54847739 target 0.54847700 |diff| 3.93e-07 tol 1.0e-06 pass Handoff Lab 3: the slope at h = 4 against the browser pass Handoff Lab 3: 194 rows at h = 5 Handoff Lab 3: the slope at h = 5 against the browser value 0.58309851 target 0.58309900 |diff| 4.90e-07 tol 1.0e-06 pass Handoff Lab 3: the slope at h = 5 against the browser pass Handoff Lab 3: 193 rows at h = 6 Handoff Lab 3: the slope at h = 6 against the browser value 0.50912038 target 0.50912000 |diff| 3.77e-07 tol 1.0e-06 pass Handoff Lab 3: the slope at h = 6 against the browser pass Handoff Lab 3: 192 rows at h = 7 Handoff Lab 3: the slope at h = 7 against the browser value 0.41778779 target 0.41778800 |diff| 2.13e-07 tol 1.0e-06 pass Handoff Lab 3: the slope at h = 7 against the browser pass Handoff Lab 3: 191 rows at h = 8 Handoff Lab 3: the slope at h = 8 against the browser value 0.24059456 target 0.24059500 |diff| 4.41e-07 tol 1.0e-06 pass Handoff Lab 3: the slope at h = 8 against the browser pass Handoff Lab 3: 190 rows at h = 9 Handoff Lab 3: the slope at h = 9 against the browser value 0.13029288 target 0.13029300 |diff| 1.22e-07 tol 1.0e-06 pass Handoff Lab 3: the slope at h = 9 against the browser pass Handoff Lab 3: 189 rows at h = 10 Handoff Lab 3: the slope at h = 10 against the browser value -0.02882139 target -0.02882100 |diff| 3.95e-07 tol 1.0e-06 pass Handoff Lab 3: the slope at h = 10 against the browser pass Handoff Lab 3: 188 rows at h = 11 Handoff Lab 3: the slope at h = 11 against the browser value -0.11719967 target -0.11720000 |diff| 3.30e-07 tol 1.0e-06 pass Handoff Lab 3: the slope at h = 11 against the browser pass Handoff Lab 3: 187 rows at h = 12 Handoff Lab 3: the slope at h = 12 against the browser value -0.29329663 target -0.29329700 |diff| 3.66e-07 tol 1.0e-06 pass Handoff Lab 3: the slope at h = 12 against the browser . . *========================================================================== . * Lab 4: the stored military-news estimate and the written hypothesis . *========================================================================== . lp_json_get using "`rec'", key(lab4.settings.h) . local h4 = `r(value)' . lp_json_get using "`rec'", key(lab4.settings.controls) . local spec4 "`r(value)'" . lp_json_get using "`rec'", key(lab4.settings.rows) . local rows4 "`r(value)'" . lp_json_get using "`rec'", key(lab4.stored.beta_h) . _lp_num "`r(value)'" . local b4 = r(x) . lp_json_get using "`rec'", key(lab4.stored.T_h) . local n4 = `r(value)' . lp_json_get using "`rec'", key(lab4.stored.beta_h_full_sample) . _lp_num "`r(value)'" . local b4full = r(x) . lp_json_get using "`rec'", key(lab4.stored.T_h_full_sample) . local n4full = `r(value)' . display as text _n "Lab 4 record: h = `h4', controls `spec4', rows `rows4'; stored estimate `b4' on `n4' rows" Lab 4 record: h = 8, controls toy, rows drop1950q3; stored estimate .433969 on 495 rows . display as text "Written hypothesis:" Written hypothesis: . lp_json_get using "`rec'", key(lab4.hypothesis) display Sample record. Dropping 1950Q3 will lower the h = 8 coefficient to about 0.30, because Korea is one of the two largest n > ews quarters. . local dir4 "`r(direction)'" . local num4 "`r(number)'" . lp_assert "Handoff Lab 4: recognized controls and rows" : /// > inlist("`spec4'", "toy", "rz") & inlist("`rows4'", "full", "drop1941q4", "drop1950q3", "dropboth", "from1947q1") pass Handoff Lab 4: recognized controls and rows . . local rz_ok 0 . capture confirm file "data/raw/RZDAT.xlsx" . if _rc == 0 { . lp_sha256 "data/raw/RZDAT.xlsx" . if "`r(sha256)'" == "b2d850872e566ebc6b95a1e057dac2226ef18b58d5a21548594f5ba86c8c6120" local rz_ok 1 . } . if !`rz_ok' { . display as text "Lab 4 re-estimation skipped: data/raw has no verified RZDAT.xlsx. Run do data/raw/get_rz.do fir > st." . post `T' ("Lab 4") ("estimate at h = `h4'") (`b4') (.) (.) ("skipped: RZDAT.xlsx not acquired") . } . else { . import excel using "data/raw/RZDAT.xlsx", sheet("rzdat") firstrow clear (28 vars, 564 obs) . drop if quarter < 1889 (56 observations deleted) . generate qdate = yq(1889, 1) + _n - 1 . format qdate %tq . tsset qdate, quarterly Time variable: qdate, 1889q1 to 2015q4 Delta: 1 quarter . generate double y = rgdp/rgdp_pott6 // real GDP / trend GDP . generate double g = (ngov/pgdp)/rgdp_pott6 // real government spending / trend GDP . generate double newsy = news/(L.rgdp_pott6*L.pgdp) // news / lagged nominal trend GDP (4 missing values generated) . local control = cond("`spec4'" == "toy", "L.y", "L(1/4).newsy L(1/4).y L(1/4).g") . local keep "" . if "`rows4'" == "drop1941q4" local keep "if qdate != tq(1941q4)" . if "`rows4'" == "drop1950q3" local keep "if qdate != tq(1950q3)" . if "`rows4'" == "dropboth" local keep "if qdate != tq(1941q4) & qdate != tq(1950q3)" . if "`rows4'" == "from1947q1" local keep "if qdate >= tq(1947q1)" . . quietly regress F`h4'.y newsy `control' . local bfull = _b[newsy] . local nfull = e(N) . display as text "regress F`h4'.y newsy `control' `keep'" regress F8.y newsy L.y if qdate != tq(1950q3) . regress F`h4'.y newsy `control' `keep' Source | SS df MS Number of obs = 495 -------------+---------------------------------- F(2, 492) = 128.20 Model | 1.37349034 2 .686745172 Prob > F = 0.0000 Residual | 2.6356001 492 .005356911 R-squared = 0.3426 -------------+---------------------------------- Adj R-squared = 0.3399 Total | 4.00909045 494 .008115568 Root MSE = .07319 ------------------------------------------------------------------------------ F8.y | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- newsy | .4339691 .0610969 7.10 0.000 .313926 .5540121 | y | L1. | .5398319 .0364573 14.81 0.000 .4682007 .6114632 | _cons | .4500998 .0361303 12.46 0.000 .379111 .5210886 ------------------------------------------------------------------------------ . local bsel = _b[newsy] . local nsel = e(N) . lp_assert "Handoff Lab 4: `n4' rows, as stored in the browser" : `nsel' == `n4' pass Handoff Lab 4: 495 rows, as stored in the browser . lp_close `bsel' `b4', tol(1e-6) label(Handoff Lab 4: the selected estimate against the browser) Handoff Lab 4: the selected estimate against the browser value 0.43396908 target 0.43396900 |diff| 7.98e-08 tol 1.0e-06 pass Handoff Lab 4: the selected estimate against the browser . lp_assert "Handoff Lab 4: `n4full' rows on the full sample" : `nfull' == `n4full' pass Handoff Lab 4: 496 rows on the full sample . lp_close `bfull' `b4full', tol(1e-6) label(Handoff Lab 4: the full-sample estimate against the browser) Handoff Lab 4: the full-sample estimate against the browser value 0.36190589 target 0.36190600 |diff| 1.14e-07 tol 1.0e-06 pass Handoff Lab 4: the full-sample estimate against the browser . post `T' ("Lab 4") ("estimate at h = `h4', `rows4'") (`b4') (`bsel') (`bsel' - `b4') ("agrees within 1e-6") . post `T' ("Lab 4") ("estimate at h = `h4', full sample") (`b4full') (`bfull') (`bfull' - `b4full') ("agrees within > 1e-6") . . * The hypothesis: direction relative to the full sample, and the number. . local actual = cond(abs(`bsel' - `bfull') < 5e-7, "unchanged", cond(`bsel' > `bfull', "raise", "lower")) . if "`rows4'" == "full" local verdict "no rows were dropped, so there is no direction to test" . else if "`dir4'" == "" local verdict "the hypothesis names no single direction" . else if "`dir4'" == "`actual'" local verdict "direction confirmed" . else local verdict "direction refuted" . display as text _n "Hypothesis direction: " as result cond("`dir4'" == "", "(none found)", "`dir4'") /// > as text ". Stata: the estimate moves from " as result %8.6f `bfull' as text " (`nfull' rows) to " /// > as result %8.6f `bsel' as text " (`nsel' rows), so the rows " as result "`actual'" as text " it." Hypothesis direction: lower. Stata: the estimate moves from 0.361906 (496 rows) to 0.433969 (495 rows), so the rows rai > se it. . display as text "Verdict: `verdict'." Verdict: direction refuted. . local hyp_num = . . if "`num4'" != "" { . local hyp_num = `num4' . display as text "Hypothesized value " as result %8.4f `hyp_num' as text "; estimate " as result %8.6f `bsel' / > // > as text "; miss " as result %8.4f abs(`bsel' - `hyp_num') Hypothesized value 0.3000; estimate 0.433969; miss 0.1340 . } . post `T' ("Lab 4") ("hypothesis: `dir4'") (`hyp_num') (`bsel') (`bsel' - `hyp_num') ("`verdict'") . } . . postclose `T' . use "output/handoff-check.dta", clear . format browser stata difference %12.8f . list, clean noobs lab quantity browser stata difference result Lab 2 slope at h = 2 2.05002400 2.05002437 0.00000037 agrees within 1e-6 Lab 3 slope at h = 0 0.87894000 0.87894028 0.00000028 agrees within 1e-6 Lab 3 slope at h = 1 0.85326000 0.85326038 0.00000038 agrees within 1e-6 Lab 3 slope at h = 2 0.61273700 0.61273705 0.00000005 agrees within 1e-6 Lab 3 slope at h = 3 0.61104600 0.61104632 0.00000032 agrees within 1e-6 Lab 3 slope at h = 4 0.54847700 0.54847739 0.00000039 agrees within 1e-6 Lab 3 slope at h = 5 0.58309900 0.58309851 -0.00000049 agrees within 1e-6 Lab 3 slope at h = 6 0.50912000 0.50912038 0.00000038 agrees within 1e-6 Lab 3 slope at h = 7 0.41778800 0.41778779 -0.00000021 agrees within 1e-6 Lab 3 slope at h = 8 0.24059500 0.24059456 -0.00000044 agrees within 1e-6 Lab 3 slope at h = 9 0.13029300 0.13029288 -0.00000012 agrees within 1e-6 Lab 3 slope at h = 10 -0.02882100 -0.02882139 -0.00000039 agrees within 1e-6 Lab 3 slope at h = 11 -0.11720000 -0.11719967 0.00000033 agrees within 1e-6 Lab 3 slope at h = 12 -0.29329700 -0.29329663 0.00000037 agrees within 1e-6 Lab 4 estimate at h = 8, drop1950q3 0.43396900 0.43396908 0.00000008 agrees within 1e-6 Lab 4 estimate at h = 8, full sample 0.36190600 0.36190589 -0.00000011 agrees within 1e-6 Lab 4 hypothesis: lower 0.30000000 0.43396908 0.13396908 direction refuted . export delimited using "output/handoff-check.csv", replace datafmt (file output/handoff-check.csv not found) file output/handoff-check.csv saved . display as text _n "Handoff check complete." Handoff check complete. . log close handoff name: handoff log: /Users/tylersotomayor/local-projections-course/practica/p01-question-to-projection/lab-project/output/hando > ff-check.log log type: text closed on: 13 Sep 2026, 22:49:11 ------------------------------------------------------------------------------------------------------------------------