zondag 15 september 2013

LaTeX: personal walk through the preamble

Introduction

LaTeX is much like the R statistical package: it forces you to load the parts of the program you will need. In contrast, most word processors load these options straight away in a standard installation - yet you may have noticed that you need to install language packs separately, for example. In LaTeX, you need to load all of it. Brilliant.

There is a good reason for this bad behaviour. It's not necessarily speed, because that doesn't seem to be a restricting factor anymore. It's rather the extensibility of the program, as well as the problems that go with it: sometimes one package conflicts with another, so we can't have both. I still think it's a serious design flaw, but it's not going to change anytime soon, I guess. So here's how to (learn to) live with it.

Packages

This is the list of packages I use in my most complex document. 

Lay-out

  • Framed: provides the commans -shaded-, -snugshade- and -leftbar-. I use snugshade for background-filled boxes. You need to define the 'shadecolor' with the color-package.
  • Color: define the colours you will use when loading this package
http://www.slideshare.net/linjaaho/how-to-make-boxed-text-with-latex
http://en.wikibooks.org/wiki/LaTeX/Colors

Fonts

  • Inputenc: allows French characters with option utf8
  • Fontenc: I don't know what it does but I set the option to T1. I believe it matters for BibLaTeX
  • Csquotes: use option autostyle=try. This interpretes quotes, so you don't need LaTeX code to use them.
% styles: http://www.emerson.emory.edu/services/latex/latex_168.html#SEC168D
% Option clash

Tables and figures

  • Graphicx
  • Caption
  • Tabularx
  • Booktabs
  • Array - permits justification options and fixed column width
  • Pgfplots: this load the TikZ language
In the preamble, specify \graphicspath{{/Users/macuser/folder/}} or anything similar on Windows so LaTeX knows where you put your graphics. I honestly love this orderly behaviour.

Bibliography

I have written a separate post on BibLaTeX. It's a pain in the X$$.


%http://texblog.org/2007/11/14/hyper-links-to-the-pdfs/

% ISSUE !!! Several capital letters in a row.
% http://forums.zotero.org/discussion/19721/bibtex-export-for-corporate-authors-single-name-only/
% http://tex.stackexchange.com/questions/69594/biber-fails-at-supporting-in-author-names


% Info BibLaTeX http://tex.stackexchange.com/questions/5091/what-to-do-to-switch-to-biblatex

%\usepackage[dutch]{babel}
 
\usepackage[american]{babel}

%\selectlanguage{dutch} 
\selectlanguage{american} 



\usepackage[style=apa, backend=biber, url=false, doi=false]{biblatex} 
% , natbib=true
% , style=apa/authoryear/verbose/numeric(default)/alphabetic/authortitle
% \usepackage[safeinputenc]{biblatex}
\DeclareLanguageMapping{american}{american-apa}  % for apa
% \DeclareLanguageMapping{dutch}{dutch-apa}   % for apa

%\addbibresource{/Users/name/Dropbox/KeepCloud/zoterobibtex.bib} % MAC
\addbibresource{C:/Users/name/Dropbox/KeepCloud/zoterobibtex.bib} % PC


% zotero biblatex exporter misses out on dates
% problem with zotero bib files: too many brackets 
% solution: biber.conf in working folder or anjo biblatex translator / robintan bibtex translator

%\usepackage[backend=biber, style=authoryear-icomp, sortlocale=nl_NL, natbib=true, url=false, 
%    doi=true, eprint=false]{biblatex}
% http://tex.stackexchange.com/questions/54833/biblatex-apa-biber

%%% Language %%%
% http://www.kronto.org/thesis/tips/multiple-languages.html

Math

  • Amsmath: it's more or less mandatory
  • Amsfonts
  • Amssymb
  • Xfrac: provides slant frac / through \sfrac{}

User modifcations

There are a lot of tweaks you may way to do to make your work look good. In doing so, you change the LaTeX wonderful defaults, so you may have used Word after all. But once you got that far, you're probably to tired to start over and you'll fuck up LaTeX till you get results without visible collateral damage.
%\usepackage[all]{nowidow}
%\clubpenalty=9996
%\widowpenalty=9999
%\usepackage[hmargin=3cm,vmargin=3.5cm]{geometry}
%\newcommand{\myparagraph}[1]{\paragraph{#1}\mbox{}\\}

%http://hapticity.net/2007/03/23/latex-itemize-bullet-characters/
\def\labelitemi{--}

%\usepackage{needspace}
%\needspace{8\baselineskip}
%$\newcommand{\E}{\mathrm{E}}$
\newcommand{\E}{\mathbb E}
\newcommand{\Var}{\mathrm{Var}}
\newcommand{\Cov}{\mathrm{Cov}}


\synctex=1

Meta-info

\author{name}
\title{title}
\date{date}

donderdag 5 september 2013

Compensating wage differentials

My work is often in-between labour economics and organization sociology/psychology. The typical cross-over topic is job quality. In this respect, one hypothesis is 'compensating wage differentials': higher wages compensate not only for schooling and investment, but also for worse working conditions or a heavy workload.

Most often, however, we see that heavy, dangerous work is not that well paid at all. On the other hand, clerical work, which is safe and needs hardly more schooling, makes for more gains. This seems to run counter to the idea of compensating wage differentials.

However, we're mixing up effects. White collar workers are most often found in sectors where higher rents can be distributed. And if not, then companies have to compete for these employees with those sectors. What we will find is that within each occupation - at least in Belgium - and within companies, there actually is fine tuning of wages based on work demands. So yes, compensating wage differentials do exist, but they are not the dominant factor: schooling and market demand are more important. This is why wages correlate with better working conditions.

A model of job quality including wage would therefore stem from a wage equation including job quality.

Wage = Schooling + Ability + DemandShift (national income) - SupplyShift (average schooling) - Job Quality

maandag 2 september 2013

A crash course in statistics

I recently managed to explain most of statistics (no, seriously) in about an afternoon using the first chapter of Intermediate Statistics: A Conceptual Course. (Sage, Pelham, B. W. (2012)) and three graphs*. After  many years of working with statistics, I actually believe it should be that easy. Also, at work, I have seen total novices use stats professionally in a matter of weeks. It is simply not that hard!
Of course, I'm not talking about assumptions, time series, endogeneity, robust standard errors, and everything that gets your stats right. I refer to what's needed to understand and report test that will be close enough. After all, a complex GMM regression with bootstrapped standard errors still return a regression coefficient and significance levels.
This would be the content of such a course:
  1. Samples and inferential statistics
  2. Average and variance
  3. The normal distribution (probability, significance)
  4. Chi2 (test and distribution)
  5. Correlations and odds ratios
  6. Regression (linear and nonlinear effects)
  7. Factor analysis
  8. Cluster analysis (similarity)
* One with linear and quadratic relations (for correlations and multiple regression), one with a factor score from two dimensions (also based on correlation), and one with clusters on a plot (similarity).

woensdag 7 augustus 2013

Start to SAS

I hated SAS for years. Because I believe the language is plain ugly, overcomplicated and unintuitive. The main pain: the fact that any DATA or PROC step (what's the difference anyway?) has a closed structure. Also, it's slow. For trial and error programming, SAS is to avoid. I still believe that.

But, sometimes, you just lack the RAM to work in beautiful languages like Stata or R. So you need to use the statistical WMD. To speed up work, there's this golden tip: compress the data sets (compress=binary). More on this here:
http://heuristically.wordpress.com/2010/08/13/make-sas-faster-data-set-compression/

maandag 29 juli 2013

Selection bias

Job quality improves during crisis, wages rise.

Selection bias.

Bad, low wage jobs disappear.

maandag 1 juli 2013

Minimum wages - a logical ground

The economic literature on minimum wages is immense. I won't address this here. Yet there is one simple argument for minimum wages: there exists some kind of wage that is the necessary minimum for a worker to reproduce the workforce. It makes no sense to pay anyone below the level of what is necessary to raise a child. If you did, in one generation your economy would be doomed. This has happened before, as is documented in Marx' Capital.

Of course, if one's market price is below the minimumwage, subsidies may be an option to get this person employed, lowering effectively the taxpayers income.

Here's a random newspaper opinion on the matter: http://www.citylimits.org/news/articles/4571/half-of-recovery-jobs-offer-low-wages-so-raise-them#.UdFhfzsqz64.

dinsdag 7 mei 2013

PGF/TikZ

For a while now I was wondering how on earth those neat vector graphics in textbooks are made. I remember my professor of international economics producing graphs in CorelDraw, which is not the state of the art software I had expected.

Because I'm studying distributions at the moment, I was looking for a LaTeX bell shaped curve. I found the GPF/TikZ package and boy, this is what I needed for so long! Within TeX/LaTeX, it's a fairly recent addition. Its predecessor is PStricks, a postscript based graphical language that can't live in a PDF world.

Unlike much of the LaTeX manuals, the TikZ documentation is very instructive and even starts with 80 pages of tutorials. By the way, up to date manuals can always be found at:


http://texdoc.net/pkg/<packagename>