set matsize 10000
global mainpath ".."

use "$mainpath\data\bc_May23.dta", clear

gen ym = mofd(date)
format ym %tm

sum ff cpi rgdp gap

*within-month std
gsort ym
by ym: egen std_ff=sd(ff)
by ym: egen std_cpi=sd(cpi)
by ym: egen std_rgdp=sd(rgdp)
by ym: egen std_gap=sd(gap)
sum std_ff std_cpi std_rgdp std_gap

*within-month-ID std
gsort ym id
by ym id: egen std_ff_id=sd(ff)
by ym id: egen std_cpi_id=sd(cpi)
by ym id: egen std_rgdp_id=sd(rgdp)
by ym id: egen std_gap_id=sd(gap)
sum std_ff_id std_cpi_id std_rgdp_id std_gap_id

*within-month-horizon std
gsort ym h
by ym h: egen std_ff_h=sd(ff)
by ym h: egen std_cpi_h=sd(cpi)
by ym h: egen std_rgdp_h=sd(rgdp)
by ym h: egen std_gap_h=sd(gap)

sum std_ff_h std_cpi_h std_rgdp_h std_gap_h

** compute correlations between alternative versions of gamma