Skip to content

Instantly share code, notes, and snippets.

View acarril's full-sized avatar

Alvaro Carril acarril

View GitHub Profile
@acarril
acarril / plotmissing.ado
Created December 13, 2017 13:55
Plot stacked missing and non-missing values over time (or some other discrete variable)
// Plot stacked missing and non-missing values over time (or some other discrete variable)
// Syntax: plotmissing var timevar
program define plotmissing
tempvar has hasnt
gen `has' = (!mi(`1'))
gen `hasnt' = (mi(`1'))
graph hbar (sum) `has' `hasnt', ///
over(`2', label(labsize(vsmall))) ///
stack legend(order(1 "Non-missing" 2 "Missing")) ///
subtitle(Relative frequency of non-missing '`1'')
@acarril
acarril / LaTeXTools.sublime-settings
Created January 5, 2018 23:19
LaTex.BibTeX.DVIPS.PS2PDF script builder for ST3 - LaTeXTools
"builder_settings" : {
// General settings:
// See README or third-party documentation
// (built-ins): true shows the log of each command in the output panel
"display_log" : false,
"options": ["--shell-escape"],
// Platform-specific settings:
@acarril
acarril / application-x-stata.xml
Created January 8, 2018 03:14
Stata .desktop files and mimetype definitions
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-stata-dta">
<comment>Stata data file</comment>
<glob pattern="*.dta"/>
<icon name="application-x-stata-dta"/>
</mime-type>
<mime-type type="application/x-stata-do">
<comment>Stata do file</comment>
<glob pattern="*.do"/>
# Curl
sudo apt -y install curl
# Atom
curl -L https://packagecloud.io/AtomEditor/atom/gpgkey | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://packagecloud.io/AtomEditor/atom/any/ any main" > /etc/apt/sources.list.d/atom.list'
sudo apt update
sudo apt -y install atom
@acarril
acarril / julia-install.sh
Last active March 4, 2019 23:32
Command line installer of latest Julia Language stable release
#!/bin/bash
bold=$(tput bold)
normal=$(tput sgr0)
downloadsPath=$(xdg-user-dir DOWNLOAD)
juliaVersion="julia-1.1.0"
# echo "${bold}1/3 Downloading"
#%% Load libraries
using DataFrames, CSV
using Statistics
using Plots, LaTeXStrings
#%% Read and prepare data
cd("/home/alvaro/Dropbox/Princeton/2020-Spring/542-IO/PS1")
df = CSV.read("data/Pset1_2020Data.csv");
# Add dummy columns for number of active firms in each market
#%% Load libraries
using CSV, DataFrames, DataFramesMeta
using LinearAlgebra
using Optim # GMM() optimization
# using FixedEffectModels
# using RegressionTables
using StatsBase # sample() for bootstrap sample
using ProgressMeter
using Latexify
@acarril
acarril / ECO524_PS3_MDP.do
Created April 23, 2020 12:24
ECO524 - PS3 - Million Dollar Plants
// Working directory
if "`c(username)'"=="alvaro" {
cd "~/Dropbox/Princeton/2020-Spring/524-PF/PS3/"
}
else di as error "DUMMY U HAVE TO CHANGE THE PATH"
// Color scheme (from SSC)
set scheme plotplain
// Political data
@acarril
acarril / corp_inc_taxreturns.csv
Last active April 29, 2020 16:27
Corporate Income Tax Returns
year tot_inc dpad tot_ded tot_cred tot_ded_no_dpad
2008 8775331143 18402344 8326939127 110593038 8308536783
2009 7886561418 14208754 7499810538 103929098 7485601784
2010 8144430285 24366835 7424856017 131342301 7400489182
2011 8389697631 27353624 7691212916 125526604 7663859292
2012 8661354506 31962519 7690545497 130747914 7658582978
2013 8784239695 33873987 7722842521 143929211 7688968534
2014 13729702329 36762355 11667987910 131633981 11631225555
2015 13981086321 36543133 12027815329 124023841 11991272196
@acarril
acarril / EconOnlineSeminars.md
Last active May 22, 2020 17:53
Econ Online Seminars

Econ Online Seminars

(IO)^2

Stanford's new Interactive Online IO seminar, aka (IO)^2.

When: Tuesdays and Fridays, 12:00 - 13:00 ET

Link