
Federal Reserve Bank of NY converts major economic model to Julia - idunning
http://libertystreeteconomics.newyorkfed.org/2015/12/the-frbny-dsge-model-meets-julia.html#.VmBiFd-rQ6g
======
chollida1
Cool, despite Julia replacing matlab here, it looks like the biggest loser to
Julia's rise might be Octave.

Matlab will always have its proponents, that will use it no matter what, but
if Julia keeps encroaching on this territory, I'm not sure where that leaves
Ocatve.

To the model discussed in this paper, check out this series of blog posts for
more information:

[http://libertystreeteconomics.newyorkfed.org/2014/09/forecas...](http://libertystreeteconomics.newyorkfed.org/2014/09/forecasting-
with-the-frbny-dsge-model.html#.VRnNb1bdIeE)

Essentially the model is a work in progress that is continually updated each
quarter. It attempts to model at a macro economic level, the interactions
between Banks, consumers, Companies, Governments and households.

Once the model has solved for the general equilibrium of how those 5 agencies
interact the model can then be used to "shock" a particular factor, such as
interest rates, to determine how this might affect the interaction between
these agents.

Its a fairly well respected model, and the fact that the US is one of the few
countries to release such a large amount of financial data is one reason why
the US is still a leader in economic theory.

~~~
wyager
> Matlab will always have its proponents

I honestly can't understand why. I'm currently in a computer vision class that
uses Matlab, and it's literally the worst language I've ever used in my life.
The design is nonsensical, bordering on malicious

I've always thought that the biggest problem with python was that as programs
get bigger, you're likely to run into some confusion due to the lack of static
typing and substantial use of implicit conversion (e.g. "Truthy" and "falsy"
values), but python has nothing at all on Matlab.

Just last night, a matrix I constructed using the expression "[x, y,
(x+scale), (y+scale)]" inexplicably had dimensions 1x8 instead of the visually
obvious 1x4, but only after a few hours of matlab slowly evaluating this
expression thousands of times without any trouble. I suspect this has
something to do with matlab's horrible ambiguous matrix concatenation syntax.

~~~
kohanz
> I honestly can't understand why

The answer is fairly obvious though, isn't it? For scientists or novice
programmers wanting to do some numerically intensive work, Matlab has
typically offered one of the quickest (in time-to-solution) prototyping
platforms. One of the keys being that you can get started very quickly, with
minimal setup (besides the expensive license and installation, something most
academics need not worry about). As a former academic programmer and now a
consultant that helps companies commercialize such prototypes, I understand
your pain, but at the same time I completely understand why a physicist,
imaging scientist, or finance major ends up using Matlab over something like
C++ or Python. Same goes for LabView, and if you despise Matlab, I challenge
you to give LabView a whirl. The gap between the Matlabs and Labviews of the
world and the other programming languages is closing in terms of ease of use
and setup time, but we're not there yet and also momentum shifts on this type
of thing take a loooong time. If you come into a lab and are working on a
research project that was started in Matlab, odds are, in the interest of
finishing your thesis on time, you're unlikely to port it to another language,
even if you have the skill to do so.

~~~
nine_k
If you single-handedly list Python and C++ together, Matlab should have some
_ridiculously_ low entry barrier. I can remember a few other horrible tools
that saw widespread use exactly because of that, e.g. Basic and PHP3/4.

Corollary: if you are offered a tool highly praised for its being
exceptionally easy for beginners, think about the price the tool had to pay in
other departments, and how will it affect you in 6-12 months of use.

~~~
lfowles
> If you single-handedly list Python and C++ together, Matlab should have some
> ridiculously low entry barrier.

The ridiculously low entry barrier exists wrt importing data and
plotting/displaying results.

------
tiffanyh
I'm always found Julia performance claims [1] to be misleading in comparison
to LuaJit [2].

Because Julia claims to be much faster than LuaJIT, yet continually - people
find that LuaJIT (not Julia) is much faster in real world test [3].

Does anyone else have experience in Julia vs LuaJIT?

[1] [http://julialang.org/#high-performance-jit-
compiler](http://julialang.org/#high-performance-jit-compiler)

[2]
[http://luajit.org/performance_x86.html](http://luajit.org/performance_x86.html)

[3]
[http://bayesanalytic.com/lua_jit_faster_than_julia_stock_pre...](http://bayesanalytic.com/lua_jit_faster_than_julia_stock_prediction/)

~~~
acidflask
Improvements to our LuaJIT benchmarking are currently being discussed in
[https://github.com/JuliaLang/julia/issues/14222](https://github.com/JuliaLang/julia/issues/14222).
LuaJIT 2.1 is significantly faster than LuaJIT 2.0, but until now I haven't
had a convenient way to get an installation of LuaJIT 2.1 on our test machine.
LuaSci was easy to install and we would be amenable to switching over to
LuaSci instead of vanilla gsl-shell. See
[https://github.com/JuliaLang/julia/issues/14222#issuecomment...](https://github.com/JuliaLang/julia/issues/14222#issuecomment-161117689)
for a timing comparison.

~~~
baldfat
I never looked at SciLua till just now. I have always liked Lua and have made
several scripts for my desktop and servers. Just never thought of Lua for Data
Science. My main issue is I haven't hit a data set to big for R in my own use
cases.

------
rlander
Even more interesting is the document on Github with technical details about
the port:

[https://github.com/FRBNY-
DSGE/DSGE.jl/blob/master/doc/Matlab...](https://github.com/FRBNY-
DSGE/DSGE.jl/blob/master/doc/MatlabToJuliaTransition.md)

~~~
b_emery
Very interesting, particularly the Challenges section:

"Differences between the behavior of MATLAB and Julia’s core linear algebra
libraries led to many roadblocks in the development of DSGE.jl. Julia uses
multithreaded BLAS functions for some linear algebra functions. Using a
different number of threads can change the results of matrix decomposition
when the matrix is singular. This indeterminacy caused significant problems
for our testing suite, both in comparing output matrices to MATLAB results and
in testing for reproducibility among Julia outputs."

Kudos to them for taking this on, I think.

------
bachmeier
The real news here is not the move to Julia (although that is likely to be the
reason for most of the attention). The important thing is the move to open -
an open language, movement to Github, nice explanation of the details.

~~~
grayclhn
No. A central bank moving at all to Julia is absolutely fucking huge.

~~~
pzone
Agreed. I worked on the FRBNY research floor, this model has real mindshare
with policy makers, porting it is a huge investment in the language. They may
be training scads of RAs in writing and using Julia, many of them will go off
and do PhDs later.

~~~
grayclhn
This also provides a lot of justification/support for those of us who'd much
rather teach (say) macroeconometrics in julia instead of matlab.

------
danso
For those of you in this field...how influential is the NYFed trying out (and
apparently being satisfied with) Julia to other government agencies,
computational economists, and/or academics? Is it "OS X is Unix/BSD-based"
influential, or "Whitehouse.gov uses Drupal [1]" influential?

[1] [http://buytaert.net/whitehouse-gov-using-
drupal](http://buytaert.net/whitehouse-gov-using-drupal)

~~~
bachmeier
To be honest, it will have very little influence. Economists don't like to
change their tools.

~~~
k2enemy
Economists don't like to change their tools, but Julia is getting a lot of
attention among grad students that are picking between Julia, Python, and
Matlab as a first language.

------
nextos
How's the probabilistic programming use case in Julia now?

I don't like Python as a language that much (I prefer Lisps or MLs), but I
reckon its libraries are fantastic: PyMC, Theano, NumPy... And loads of
general-purpose stuff.

------
has2k1
I like the use of the Greek alphabet in the code base.

Examples

[https://github.com/FRBNY-
DSGE/DSGE.jl/blob/master/src/solve/...](https://github.com/FRBNY-
DSGE/DSGE.jl/blob/master/src/solve/gensys.jl#L92)

[https://github.com/FRBNY-
DSGE/DSGE.jl/blob/master/src/solve/...](https://github.com/FRBNY-
DSGE/DSGE.jl/blob/master/src/solve/gensys.jl#L170)

~~~
cauthon
Whoa that's awesome, are there any other languages that allow that?

~~~
lg
lots:
[http://rosettacode.org/wiki/Unicode_variable_names](http://rosettacode.org/wiki/Unicode_variable_names)

------
kolbe
I've never written a line of Julia in my life, and I'm usually somewhat adept
at figuring out what is going on when I read the source of unfamiliar
languages. But I'm am having one helluva time trying to differentiate comments
and code.

EDIT: downvotes? wtf?

~~~
burke
I haven't either, but they just start with a #, right? What's the problem?

EDIT: Oh, I see there are multiline comments.

~~~
kolbe
I see things that look a lot like english sentences that are neither preceded
by #, nor surrounded by #= =#.

edit: with examples. this code, all the way up to line 48 looks like some
comments, but also a bunch of sentences without the comment characters.

[https://github.com/FRBNY-
DSGE/DSGE.jl/blob/master/src/solve/...](https://github.com/FRBNY-
DSGE/DSGE.jl/blob/master/src/solve/gensys.jl)

~~~
3JPLW
You're looking at a markdown-formatted docstring. Note that it's enclosed in
""", similar to Python except that it precedes the method definition. Within
the markdown formatting, you can use ``` fences to format code examples.

GitHub's coloring here doesn't quite make it as obvious as it can be. Here's
how it renders at the REPL with the help system:
[http://imgur.com/rlAnpSK](http://imgur.com/rlAnpSK)

~~~
kolbe
cool. thank you.

