March 2017

I really want to like Julia. She promises to solve all the frustrations with other numerical languages.


March 2017

I really want to like Julia. She promises to solve all the frustrations with other numerical languages.



Central bank digital currencies
13 January 2021
Erasmus and Turing
11 January 2021
Brexit and Marxism
3 January 2021
What to do about the Covid financial system bailouts?
22 December 2020
The crypto-technical response to the Covid-19 bailouts
13 December 2020
The libertarian response to the Covid-19 financial turmoil
9 December 2020
The socialist response to the Covid-19 financial turmoil
4 December 2020
On the response of the financial authorities to Covid-19
2 December 2020
The Covid-19 bailouts and the future of the capitalist banking system
26 November 2020
Which programming language is best for economic research: Julia, Matlab, Python or R?
20 August 2020
ARM on AWS for R
15 June 2020
Low vol strategies
8 May 2020
Of Julia and R
8 May 2020
How to manipulate risk forecasts 101
30 April 2020
The five principles of correct riskometer use
27 April 2020
The problem with Backtesting
25 April 2020
The magic of riskometers
24 April 2020
Risk and scientific socialism
23 April 2020
Financial crises and epidemics
19 April 2020
Hayek and Corona
17 April 2020
Hayek et Corona
17 April 2020
Ignoring the Corona analysis
15 April 2020
The coronavirus crisis is no 2008
26 March 2020
Artificial intelligence as a central banker
6 March 2020
Systemic consequences of outsourcing to the cloud
2 December 2019
The dissonance of the short and long term
12 August 2019
Central banks and reputation risk
6 August 2019
The Brexit culture war
5 May 2019
All about BoB — The Bank of England Bot
29 April 2019
My tiny, tiny contribution to Apple's fall in profits
6 January 2019
The 2018 market in a 250 year context
1 January 2019
Short and long-term risk
3 December 2018
Perceived and actual risk
2 December 2018
Cryptocurrencies: Financial stability and fairness
9 November 2018
The October 2018 stock market in a historical context
1 November 2018
The hierarchy of financial policies
12 September 2018
Which numerical computing language is best: Julia, MATLAB, Python or R?
9 July 2018
26 June 2018
What are risk models good for?
3 June 2018
The McNamara fallacy in financial policymaking
1 June 2018
VIX, CISS and all the political uncertainty
20 May 2018
Here be dragons
30 March 2018
Low risk as a predictor of financial crises
26 March 2018
Cryptocurrencies don't make sense
13 February 2018
Yesterday's mini crash in a historical context
6 February 2018
Artificial intelligence and the stability of markets
15 November 2017
European bank-sovereign doom loop
30 September 2017
Do the new financial regulations favour the largest banks?
27 September 2017
The ECB Systemic Risk Indicator
24 September 2017
Finance is not engineering
22 September 2017
University of Iceland seminar
14 June 2017
Brexit and systemic risk
31 May 2017
Should macroprudential policy target real estate prices?
12 May 2017
Learning from history at LQG
13 April 2017
Is Julia ready for prime time?
12 March 2017
With capital controls gone, Iceland must prioritise investing abroad
12 March 2017
Competing Brexit visions
25 February 2017
Systemic consequences of Brexit
23 February 2017
Why macropru can end up being procyclical
15 December 2016
The fatal flaw in macropru: It ignores political risk
8 December 2016
Why it doesn't make sense to hold bonds
27 June 2016
On the financial market consequences of Brexit
24 June 2016
Cyber risk as systemic risk
10 June 2016
Big Banks' Risk Does Not Compute
24 May 2016
Interview on þjóðbraut on Hringbraut
21 May 2016
Farewell CoCos
26 April 2016
Will Brexit give us the 1950s or Hong Kong?
18 April 2016
Of Brexit and regulations
16 April 2016
IMF and Iceland
12 April 2016
Stability in Iceland
7 April 2016
Everybody right, everybody wrong: Plural rationalities in macroprudential regulation
18 March 2016
Of tail risk
12 March 2016
Models and regulations and the political leadership
26 February 2016
Why do we rely so much on models when we know they can't be trusted?
25 February 2016
Does a true model exist and does it matter?
25 February 2016
The point of central banks
25 January 2016
Volatility, financial crises and Minsky's hypothesis
2 October 2015
Impact of the recent market turmoil on risk measures
28 August 2015
Iceland, Greece and political hectoring
13 August 2015
A proposed research and policy agenda for systemic risk
7 August 2015
Are asset managers systemically important?
5 August 2015
Objective function of macro-prudential regulations
24 July 2015
Risky business: Finding the balance between financial stability and risk
24 July 2015
Regulators could be responsible for next financial crash
21 July 2015
How Iceland is falling behind. On Sprengisandur
12 July 2015
Greece on Sprengisandur
12 July 2015
Why Iceland can now remove capital controls
11 June 2015
Market moves that are supposed to happen every half-decade keep happening
14 May 2015
Capital controls
12 May 2015
What do ES and VaR say about the tails
25 April 2015
Why risk is hard to measure
25 April 2015
Post-Crisis banking regulation: Evolution of economic thinking as it happened on Vox
2 March 2015
The Danish FX event
24 February 2015
On the Swiss FX shock
24 February 2015
Europe's proposed capital markets union
23 February 2015
What the Swiss FX shock says about risk models
18 January 2015
Model risk: Risk measures when models may be wrong
8 June 2014
The new market-risk regulations
28 November 2013
Solvency II: Three principles to respect
21 October 2013
Political challenges of the macroprudential agenda
6 September 2013
Iceland's post-Crisis economy: A myth or a miracle?
21 May 2013
The capital controls in Cyprus and the Icelandic experience
28 March 2013
Towards a more procyclical financial system
6 March 2013
Europe's pre-Eurozone debt crisis: Faroe Islands in the 1990s
11 September 2012
Countercyclical regulation in Solvency II: Merits and flaws
23 June 2012
The Greek crisis: When political desire triumphs economic reality
2 March 2012
Iceland and the IMF: Why the capital controls are entirely wrong
14 November 2011
Iceland: Was the IMF programme successful?
27 October 2011
How not to resolve a banking crisis: Learning from Iceland's mistakes
26 October 2011
Capital, politics and bank weaknesses
27 June 2011
The appropriate use of risk models: Part II
17 June 2011
The appropriate use of risk models: Part I
16 June 2011
Lessons from the Icesave rejection
27 April 2011
A prudential regulatory issue at the heart of Solvency II
31 March 2011
Valuing insurers' liabilities during crises: What EU policymakers should not do
18 March 2011
Risk and crises: How the models failed and are failing
18 February 2011
The saga of Icesave: A new CEPR Policy Insight
26 January 2010
Iceland applies for EU membership, the outcome is uncertain
21 July 2009
Bonus incensed
25 May 2009
Not so fast! There's no reason to regulate everything
25 March 2009
Modelling financial turmoil through endogenous risk
11 March 2009
Financial regulation built on sand: The myth of the riskometer
1 March 2009
Government failures in Iceland: Entranced by banking
9 February 2009
How bad could the crisis get? Lessons from Iceland
12 November 2008
Regulation and financial models: Complexity kills
29 September 2008
Blame the models
8 May 2008

Is Julia ready for prime time?

12 March 2017

March 2017

I really want to like Julia. She promises to solve all the frustrations with other numerical languages.

The contenders

At the moment I use R which first appeared 41 years ago, and occasionally Matlab which also dates back to the 1970s. And the age shows, they are archaic, irrational, slow and just plain frustrating. For the R issues take a look at the R inferno.

OK, these three are not as bad as SAS, now 51 years old, and is as close to being a crime against humanity as one gets with programming languages. I know many who use it, arguing SAS is the only game in town for really large datasets, but then why not use R inside Oracle or the Microsoft SQL server?

There is one possibility, NumPy, a numerical computation package for python. I love python and use it all the time. Numpy feels incongruous, numerical code crafted onto a language designed for a very different purpose. If R/Matlab are bad, Numpy is worse. No.

Not only are these languages archaic and clumsy, they are slow. I often use embedded C++ in R, getting 20 times or more speed improvement.

Julia to the rescue?

So, what about Julia? It certainly got endorsements from the people I respect, like Thomas J. Sargent. Julia is a modern language, very elegant and fast. It would be fantastic to be able to switch from R and Matlab to Julia.

So, I took Julia for a spin, trying to implement a Julia version of my R and Matlab book code.

Just not possible.

It started easy.

Here is the start of the R code (Matlab is quite similar). It downloads SP-500 data from

price = get.hist.quote(instrument = "^gspc")

In Julia (as well as in R/Matlab) one can use Quandl:

using Quandl;

It is a commercial product, so not quite the same as using R get.hist.quote(), but gets the job done.

Still so far so good.

max and maximum

In Julia min() and max() are not used to get the min() and max(), but for something else, the minimum of the arguments, so need


OK, for a numerical language, where we are used to using min(x) and max(x) for the minimum of the vector x, why do it this way? Here is why. I can see the reason, but it is annoying.

At least why not give us a better error message than

julia> max(x)
ERROR: MethodError: no method matching max(::DataArrays.DataArray{Float64,1})

Like perhaps adding something like “did you mean maximum(y)?”

Basic statistical tests and plots

My book code has some simple autocorrelation calculations and tests.

R has it

Box.test(y, lag = 20, type = c("Ljung-Box"))

and so does Matlab


To do that in Julia I have to code this up myself. We have


but what about the confidence bounds and plot and tests?

Same thing applies to analysis of distributions, like QQ plots. (yes that exists, and no, you probably don’t want to go there).


Getting into more sophisticated analysis, like GARCH, there is a very basic candidate, missing most needed functionality, see here. It installs, but fails on dependencies (NLopt had build errors). Why then install it to begin with? R would reject it. Bizarrely, then Julia still then loads it without complaining:

using GARCH
fit = garchFit(y)
ERROR: UndefVarError: garchFit not defined

So no GARCH.


And finally, plotting, not sophisticated like the R acf() and sacf() in Matlab. But just a simple plot of a vector. Try plot(y). Good luck.

Here is the official advice. First suggestion uses plotly() which opens in browser tabs, new tab for every call. That will drive you crazy quite quickly. I like plotly, I use it here, but it is a crappy first recommendation for plotting in a numerical package. Second recommendation is pyplot(). Fonts so small I can’t see them, and will not put the plot window into the foreground when plot() is called!

A bit sad having to call either js or python to make simple plots. And since the R plot() or ggplot() are much better than either of those, why not recommend them instead? Here is one way.

Not quite the same as having it built in.

To conclude

Many of the missing things are easy to code, but a numerical language where one has to manually code the autocorrelation functions? Makes me wonder about what else I would have to manually code. Libraries are there for a reason.

This is where I gave up, it is just not possible to translate the very simple book code into Julia without serious coding of what should be library functions.

So, as much as I wanted to like Julia, she is not yet ready for prime time, at least not with my type of applications. But its early days.

I did write some numerically intensive code and Julia did live up to the promise. It is a great language to program in, much better than R, Matlab and Numpy, and much faster.

I fully expect Julia to fill in the gaps and become useful in my work at some point. The day I can stop programming in R and Matlab, switching to Julia, will be a great day.

© All rights reserved, Jon Danielsson, 2021