The Swiss Labour Force Survey: Working with labeled data in R
18 Nov 2020
The Swiss Labor Force Survey (SLFS) data is available to researchers by request, where each year’s data is provided as a large CSV file along with two additional sets of variable and value label files that have been exported from SAS and SPSS into TXT format. For those wishing to work with these label files in R, I introduce a few custom functions that transform the supplied label files into named objects that play nicely with the tidyverse haven and labelled packages.
Harmonizing Swiss commune data
30 Sep 2020
Swiss communes are the smallest administrative spatial unit in the country and their borders change over time as units merge, split or exchange territories. In order to create balanced panels that are consistent over time for longitudinal analysis, municipal-level data should be harmonized to the territorial boundary definitions for a given year. For a recent project, I mapped all Swiss communes from 1994 onwards to their present borders as of January 2020.
COVID-19 Tracker: Days since N
19 Mar 2020
UPDATE (5 Oct. 2021): I created this app so that I could quickly visualize and compare data for the countries that I was personally most interested in during the early days of the pandemic, before the subsequent explosion of dashboards and apps appeared online relating to all things COVID-19. I haven’t had time to work on this in over a year, and others have created far better versions, so I’ve decided to archive the project.
Impulse-reponse plots with `vars` and `ggplot2`
21 Feb 2020
While the vars package makes calculating and plotting impulse-response function as easy as can be, I find the plots generated from the pre-defined methods in the package leave much to be desired. In this post, I show a work-around that allows you to extract the relevant impulse-response vectors returned from the irf() function in vars into a nicely-boxed dataframe that is ggplot-friendly and allows for easier-to-customize plots. The example data set used in this post comes from some recent work I’ve done analyzing the impact of refugee migration on the Swiss economy from 1991 to 2019 using a Structural Vector Autoregression (SVAR) identification scheme that is commonly used to estimate the macroeconomic effects of structural shocks and policies.
Money, market value and competition in modern football
7 Feb 2020
In this blog post, I scrape the market value estimations from the Transfermrkt website and use them to describe the flow and concentration of money in the top-tier of European football. I trace the evolution of market value for all players in the top five European leagues, compute a measure of the market concentration as a proxy for competitiveness within each league, and then estimate the relationship between market share and performance by way of points accumulated by each club per season.
Refugee supply shocks and the Swiss labor market, Part II: Expanding the sample, analyzing alternative outcomes
17 Dec 2019
In this post, I revisit Part I of my analysis of the effects of the Balkan refugee shock on the Swiss labor market. The analysis in the original post was conducted in Stata, but for the follow-up, I re-write all of the code in R, examine the effects of expanding the very restricted sample population in the original analysis, and estimate the impact of the Balkan refugee supply shock on additional labor market outcome variables.
Predicting household poverty in Latin America, Part II: Evaluating multi-class classification models with caret
31 Oct 2019
In this post, I evaluate the performance of some popular supervised classification algorithms using caret and the Costa Rican Household Poverty (CRHP) dataset provided by the Inter-American Development Bank (IDB), by way of Kaggle.
The challenge and the data In Latin America, as in many other parts of the world, accurate targeting of social welfare programs is made difficult given the lack of income and expense records in the poorest segments of the population.
Predicting household poverty in Latin America, Part I: Re-splitting the CRHP dataset
30 Oct 2019
I rarely every come across publicly available datasets that I find interesting from a socio-economic welfare perspective, so when I spotted the Costa Rican Household Poverty (CRHP) dataset on Kaggle, I jumped at the chance to dig in and explore it a bit. Unfortunately, the full training and test sets have still to be released on the site, so in this post, I re-purpose the available data, clean and pre-process it.
Stata to R cheatsheet for Econometrics
11 Oct 2019
Within the field, Stata is the dominant software package for economists. I suspect a large portion of universities, like mine, still do alot of their teaching using it, and given its outsized influence, it’s probably still important to know how to use it if you plan to continue studying or working in the field.
Outside of Economics, however, R is more widely used, more versatile, and just as importantly, free. It’s also true that R is far less user friendly than Stata and can be confusing given the wide range of different approaches, packages and even syntax that are all used to do the same things that seem so effortless in Stata.
PSE Summer School, Migration Economics
28 Jun 2019
Classes are finally over for the semester, and the summer break means I have a bit of extra personal time for some of the personal projects and events that I’ve been planning during the past year. At the top of the list is one of two summer courses I’ve signed up for: Migration Economics at the Paris School of Economics.
I looked at a few different summer school options, but went with this one mostly based on the detailed agenda and reading list that they published online beforehand.
Refugee supply shocks and the Swiss labor market, Part I.
29 May 2019
In this post, I have a look, myself, at the impact of the Balkan refugee immigration shock of the 1990s on the Swiss labor market Using the region-skill-cell approach.
As has been widely discussed in the economic literature, the impact of migration on local labor markets in the developed countries of the global north is a contested topic that has important ramifications for national economic and social policy-making, and is, perhaps, an important factor that shapes popular sentiment and behavior towards foreigners more generally1.
Econ journals and software
22 Mar 2019
As part of my Applied Econometrics course this semester, we have lab time each week where we’re working in Stata. As it’s been made clear to us, Stata still dominates all other statistical analysis packages in the field of Economics, and it carries distinct advantages–namely, it’s relative ease of use, along with its status as the lingua franca among Economists.
In spite of our classes, we’ve been told that we’re free to use whatever software we’d like for our assignments and thesis.