zondag 6 november 2016

Zero marginal costs

There is an interesting phenomenon on its way which we do not fully understand yet. It's the computer revolution. Now many observer believe that the second machine age is like the first, that technology has always been seen as a threat but in hindsight created more work and welfare. I do not buy that for a number of reasons.

First, the simple stat is flawed. Yes, more people work and there is more welfare, but there are also many more people living on earth compared with the middle ages. We do not have precise observations, but it is not unlikely that the majority of the people before the industrial revolution were all working full time, regardless of age and sex. So the machines may have enhanced the labour force, and freed up time for leisure for most, but some are unlucky not to have the skills that suit a machine. In order to let them accept the introduction of technology, we should therefore always distribute welfare, also to those who have made room for progress.

Second, in this machine age, I believe we are heading towards a point were the very human aspect of labour, not its force, but its knowledge, is being substituted by computers. That is very different, because it excludes complementarity of capital and labour to a much larger extent. For now, this leads to job polarization, but soon software may take over more advanced tasks which have now fairly big gains, and robots might take over many service jobs that require a 'human touch'.

Third, the apologists say fear is not needed as the past predicts the future and we've sorted it out last time. I believe that is the wrong motivation. Fear is not needed, indeed, but not because nothing is going to change, but because it is possible to see a change for the better. Why, after all, would we want to work? We don't, that's why we ask a wage in return for the trade of leisure. For those who think this will lead to a demographic boom, maybe not: if we spend more time caring about individuals, we have a new constraint other than the price of education: the time which we cannot multiply. Also, procreation brings responsabilities, which we may want to keep under control.

Fourth, I tend to agree with Paul Mason that there will be a change of system. The steam machine introduced capitalism. After all, those machine are capital that allows the making of profits, of which part goes to the worker and the rest to the shareholder. The new technology works autonomous, which will actually take away profit. We tend to think of companies that adopt technology as labour-killers, but what they really are is profit-killers. The beauty of capitalism is that companies will always want to be the first to go on that road, because then profits actually increase. As soon as one more company follows, we have Bertrand competition that drives prices to zero, because software (the new capital) produces its goods and services at zero marginal costs. I thought of this a while back, and others have without a doubt too, but Paul Mason found a really interesting note of Karl Marx who predicted exactly this, and it is entirely in line with marxist economics. If labour becomes obsolete, there is no more income and no more turnover. So it is a system changer. Now before we yahoo about this, nobody knows what the new system will be. It is possible that we distribute according to needs, or based on a basic income scheme equally for all. It is also possible that capital holders will manage to protect intellectual right on software and intangible products (like a song or a movie), and have ordinary people sweat to obtain it without actually contributing much to society. Amongst capitalists, there will then be a fair amount of trade, owning brands and intellectual rights, and forming cartels much like today, while those who were former workers will then be slaves. Personally I think the latter scenario is most likely, even if it relies on reducing democracy. It is probably even already ongoing.

So in sum, there will be a change and it could be for the better or worse, depending on whether you catalogue more equality as the former or the latter. It certainly deserves a debate.

zondag 10 april 2016

EU28 Member States in seven clusters

It's a very repetitive task to always cluster European Union Members States, but despite the heterogeneity in any possible group of clusters, it is probably the only way to have a basis for comparison.

My preferred clusters consist of the EU-15 and the New Member States, or Central and Eastern Europe. Within each group, we can further split up by broad welfare state or cultural groups. The syntax below for Stata should be self-explanatory.

gene byte eu28 = 0
replace   eu28 = 1 if inlist(geo,"BE","DE","FR","AT","NL")  // Continental Western Europe
replace   eu28 = 2 if inlist(geo,"GB","IE")     // British isles
replace   eu28 = 3 if inlist(geo,"SE","FI","NO","DK")     // Scandinavia
replace   eu28 = 4 if inlist(geo,"ES","IT","PT","GR")     // Southern Europe
replace   eu28 = 5 if inlist(geo,"HU","PL","SI","SK","CZ")  // CEE Slavic (and Hungary)
replace   eu28 = 6 if inlist(geo,"LT","LV","EE")            // CEE Baltic
replace   eu28 = 7 if inlist(geo,"HR","RO","BG","CY","MT")  // CEE Balkan and Mediterranean Isles

vrijdag 23 oktober 2015

Stata float detail

Beware, Stata may be the most comfy and reliable software for STATistical Analysis, but it sucks in comparison with your handheld calculator if you want to come up with the simplest of figures. Why? Because computers do not see 0.1 as we do (decimal issue), and because there is a trade off between precision and speed or efficient storage (rounding issue).

Below is an experiment to show the second issue. Make three variables with long numerics, store them as float, double, and default. As there are more then 7 digits of precision, the float variable will be rounded.

clear
set obs 1
gene float  varfloat = 2567987654 
gene double vardouble = 2567987654
gene vardefault         = 2567987654

gene float varfloatchange = 10
replace varfloatchange   = 2567987654
format * %15.0f
list

     +---------------------------------------------------+
     |   varfloat    vardouble   vardefault   varfloat~e |
     |---------------------------------------------------|
  1. | 2567987712   2567987654   2567987712   2567987712 |
     +---------------------------------------------------+

As you can see, the default type was float, an Stata did not store any float variable with the same precision as the input. Instead, we have another figure, which happens to be 2567987712 for no apparent reason. It's not random, because if you rerun the syntax it is always the same. Probably it is some rounded exponentiated figure or the closest figure obtainable in a binary series of 7 digits or so.


donderdag 22 oktober 2015

Stata code for Herfindahl concentration index

Herfindahl concentration index

The Herfindahl concentration index computes a score between 0 (total dispersion) and 1 (total concentration) which is the sum of all squared shares within a unit.

In the working example hours per job for workers are used.

tempvar t1
egen `t1' = total(hours), by(workerid year)
tempvar t2
gene `t2' = (hours / `t1')^2
egen herfindahl = total(`t2'), by(workerid year)
drop `t1' `t2'
label var herfindahl "Herfindahl concentration index"

maandag 21 september 2015

Strongly balanced sample (Stata simulation)

clear
local base = 4      /* Set nr. of observations per units */
local size = 200    /* Set nr. of units */

*****
local tot = `size' + `base' - 1
di `tot'
set obs `tot'
gene id = floor(_n / `base')
gene time = `base'*(_n/`base' - id) + 1
drop if _n < `base'

*****
xtset id time

dinsdag 7 juli 2015

Using -reindex- to calculate real trends

We live in a real world, not in a nominal fiction. Hence it is practical and sensible to express amounts of money in real terms. I will show how to use my Stata user command - reindex -  to help you with this.

There is no straightforward way of deflating. When the monetary base expands, inflation may result. But it is also possible that economic activity increases, in which case you can still buy one can of coke with one euro, but as you happen to have two euros, you can buy two.

There are four standard ways of deflating prices:

  1. The GDP deflator is the ratio between the nominal gdp and the 'real' gdp which is the counterfactual with prices of the reference year. Even if it seems a logical way of calculating price increases, there are numerous biases in this measure - I can't find out what to do with new goods that weren't priced the year before. The standard GDP deflator is measured based on goods produced in the economy. 
  2. The deflator of consumed goods is exactly the same but with the current goods that are purchased. Importantly, the basket of goods changes every year.
  3. The (national) consumer price index is a fixed basket of goods corresponding to the average household's consumption, of which prices are tracked over time. Only in the longer term the basket is changed, often when goods have become out of fashion for a while already. Sometimes there are minor adjustments to the weights of goods.
  4. The harmonised consumer price index is the same as above but with an internationally harmonised basket of goods. Of all deflators I find this one capturing inflation best.
Data may be monthly, quarterly, come as an index or as a yearly change. Before continuing, make sure you transform into the time period of the nominal variable you want to convert. Indicate the unit within i() and the year variable in j(). Merge the data based on year and units.

Now use -reindex- to set both the deflator and the nominal variable to the same type. Reindex can work with four types:
  • Levels
  • Index
  • Percentages
  • Factors
Note that levels can only be converted into the trend types, not the other way around. Note also that percentages and factors are actually the same thing, but the percentage change is the factor change minus one.

For percentage trends, we commonly find an expression like the following:

%.real growth = %.nominal growth - %.inflation

This is a rule of thumb that is ok for small numbers. However, the right calculation is in factors:

nominal growth / real growth = inflation,

which in logs would be ln.nominal - ln.real = ln.inflation and as the log of a factor between .90 and 1.10 is very close to the percentual change (i.e. factor - 1), the 'easy' formula above would hold.

We can move factors to obtain:

real = nominal / inflation

The above we can also use with indices, where you set the base for all indices in one and the same year marked by tobase() to 100 using toscale(), except for the deflator (inflation) which you set to 1. The reindex program allows setting the base time and scale. 

woensdag 10 juni 2015

Stata user commands

Here's a list of Stata user commands I have found valuable:

Data manipulation

  • eurostatuse - our Eurostat download plugin (get it through ssc install eurostatuse)
  • usespss and savespss - spss conversion (be careful with variable precision and rounding)
  • gsample - extended sample

Data cleaning

  • copydesc - copy labels between variables
  • nmissing and npresent - to check the number of valid and missing cases on a variable
  • isko - conversion of ISCO codes into EGP and SEI
  • kountry - ISO country codes
  • labvars - extended labeling options
  • varlab - extended labeling options

Calculations

  • domin - decomposition of explained variance by regressors
  • nldecompose - non-linear decomposition methods
  • oaxaca - decompositions
  • polychoric - for calculating polychoric correlation matrices and performing polychoric factor analysis

Output creation

  • md - log file parser
  • grc1leg - graph combine with 1 legend
  • profileplot - plots with means on several variables
  • markup - log file parser
  • markdown - log file parser
  • synlight - log file parser
  • weave - syntax parser

I forgot why I found these useful

  • quote - no idea
  • results - no idea
  • txt - no idea