My Julia DataFrames cheatsheet

Creating and calculating within groups In Stata: bysort group1 group2 (t): egen sum = sum(freq) generate prob = freq/sum bysort group1 group2: gen cumul = sum(prob) In Julia: sort!(df, ) df = transform(groupby(df, ), :freq => sum => :sum) df = df ./df df = transform(groupby(df, ), :prob => cumsum => :cumul) Collapsing data Stata: collapse (sum) freq, by(group) Julia:...

My R cheatsheet

data.table DescriptionR command(Stata command)Produce freq. table by groupdt tab groupCompute max of var per groupdt by group: g r_id = _n lubridate (w/ data.table) DescriptionR commandCreate Date from stringdt Convert Date to year-quarterdt[, yq := quarter(date_var, with_year=TRUE)Create Date from components (e.g., year-quarter from year and quarter)yq = quarter(parse_date_time(paste0(year,...

A macro-finance glossary

I've done some searching online, but so far failed to find any glossary of frequently used macro-finance term. So I started to put together my own. In my experience, a good way to memorize concepts is to write them down in my own words; as I revisit my glossary, I edit definitions, correct my previous misconceptions, and try to condens the text. It's not only a good way to retain the meaning of...

Something fixed effects

Many times have I seen in seminars tables where researchers list all the robustness checks they've done, adding controls, adding fixed effects, mixing them, and interacting them. The coefficient of importance hopefully remains about the same. But then, again, someone will ask for an additional control to be added. What too often people don't realize is this: what they are asking for is already...