Skip to content

Instantly share code, notes, and snippets.

View acarril's full-sized avatar

Alvaro Carril acarril

View GitHub Profile
@acarril
acarril / Chile_IPC_anual.csv
Last active August 3, 2020 16:07
Inflación media de Chile medida por IPC promedio anual / Chilean annual CPI index (fuente: https://www.inflation.eu/es/tasas-de-inflacion/chile/inflacion-historica/ipc-inflacion-chile.aspx)
year cpi_percent
2020 3.32
2019 2.56
2018 2.43
2017 2.19
2016 3.8
2015 4.35
2014 4.39
2013 1.93
2012 3.02

This works only on Unix.

  1. Get youtube-dl
  2. List the formats for the video with
youtube-dl --list-formats <url>

You'll get an output like

[youtube] h3--ed9sOQo: Downloading webpage
[youtube] h3--ed9sOQo: Downloading m3u8 information
# Compute transition matrix based on a distribution
using LinearAlgebra, Distributions
function fTransitionMatrix(grid; dist = LogNormal())
N = size(grid)[1]
Mat = UpperTriangular(transpose(repeat(grid, outer=[1, N])) .- grid)
prMat = cdf.(dist, Mat)
trMat = hcat(prMat[:, 2:end], ones(N)) .- prMat
end
@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

@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 / 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
#%% 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
#%% 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
@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"
# 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