Differences between revisions 48 and 49
Revision 48 as of 2009-06-23 18:54:34
Size: 8890
Comment:
Revision 49 as of 2009-07-03 13:15:00
Size: 8770
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
Dynare is now able to run on GNU Octave, which is basically a free clone of Matlab. Dynare is now able to run on GNU Octave, which is basically a free clone of MATLAB.
Line 7: Line 7:
Octave 3.0.x series are supported. At the time of this writing, Dynare doesn't work on Octave 3.2.x series. Octave 3.0.x series are supported. At the time of this writing, Dynare doesn't work on Octave 3.2.0, because of a bug in Octave's which() function.
Line 11: Line 11:
GNU Octave is a free clone of Matlab, running under Linux, Windows and MacOS. GNU Octave is a free clone of MATLAB, running under Linux, Windows and MacOS.
Line 32: Line 32:
 * Download Octave for Windows on the [[http://sourceforge.net/project/showfiles.php?group_id=2888&package_id=287261|following page]]. Pick the latest version in the 3.0.x series. At the time of this writing, Dynare does not work with 3.2.x series.  * Download Octave for Windows on the [[http://sourceforge.net/project/showfiles.php?group_id=2888&package_id=287261|following page]]. Pick the latest version in the 3.0.x series. At the time of this writing, Dynare does not work with Octave 3.2.0.
Line 37: Line 37:
'''Note 2:''' the distribution of Octave for Windows contains a nice text editor, which you can invoke with {{{edit}}} as you would under Matlab. '''Note 2:''' the distribution of Octave for Windows contains a nice text editor, which you can invoke with {{{edit}}} as you would under MATLAB.
Line 53: Line 53:
For Debian "Lenny" or Ubuntu "Hardy Heron" or "Intrepid Ibex", see InstallOnDebianOrUbuntu. For Debian or Ubuntu distributions, see InstallOnDebianOrUbuntu.
Line 73: Line 73:
Then, from Octave, add the path to Dynare with the {{{addpath}}} command, as you would under Matlab: Then, from Octave, add the path to Dynare with the {{{addpath}}} command, as you would under MATLAB:
Line 116: Line 116:
== Main differences between Matlab and Octave which are dealt with by Dynare == == Main differences between MATLAB and Octave which are dealt with by Dynare ==
Line 120: Line 120:
 * '''Reciprocal condition number''': {{{rcond(A)}}} doesn't exist under Octave. For the moment, the workaround is to create a {{{rcond.m}}} M-file which does {{{1/(norm(A,1)*norm(inv(A), 1))}}}. The {{{rcond()}}} function should be available in the next major release of Octave, see [[http://www.cae.wisc.edu/pipermail/octave-maintainers/2008-May/007332.html|this post]] and its reply.  * '''Reciprocal condition number''': {{{rcond(A)}}} doesn't exist under Octave. For the moment, the workaround is to create a {{{rcond.m}}} M-file which does {{{1/(norm(A,1)*norm(inv(A), 1))}}}. The {{{rcond()}}} function is now available in Octave 3.2.
Line 130: Line 130:
 * The operator {{{&}}} under Matlab is buggy: it doesn't execute its second argument if the first is false, when used in an {{{if}}} statement. This behaviour should be restricted to {{{&&}}}. This also applies to {{{|}}} and {{{||}}}. Implied a change in {{{mh_optimal_bandwith.m}}}, since this file expects the buggy behaviour  * The operator {{{&}}} under MATLAB is buggy: it doesn't execute its second argument if the first is false, when used in an {{{if}}} statement. This behaviour should be restricted to {{{&&}}}. This also applies to {{{|}}} and {{{||}}}. Implied a change in {{{mh_optimal_bandwith.m}}}, since this file expects the buggy behaviour
Line 134: Line 134:
 * {{{ordeig()}}} doesn't exist under Octave (nor on Matlab < 7.0.1). Use {{{my_ordeig()}}} instead.  * {{{ordeig()}}} doesn't exist under Octave (nor on MATLAB < 7.0.1). Use {{{my_ordeig()}}} instead.

Dynare with Octave

Dynare is now able to run on GNU Octave, which is basically a free clone of MATLAB.

Octave 3.0.x series are supported. At the time of this writing, Dynare doesn't work on Octave 3.2.0, because of a bug in Octave's which() function.

About Octave

GNU Octave is a free clone of MATLAB, running under Linux, Windows and MacOS.

It normally runs in a command window, and displays graphics in separate windows (using Gnuplot).

Some ressources:

Installing Dynare with Octave

Windows (without Cygwin)

This is the recommended way for Windows users.

  • Download Octave for Windows on the following page. Pick the latest version in the 3.0.x series. At the time of this writing, Dynare does not work with Octave 3.2.0.

  • Download and install the latest Dynare package for Windows, see http://www.dynare.org (pick the most recent package for Windows 32 bits in the download section).

Note: the Dynare package for Windows won't work with versions of Octave for Windows older than 3.0.5.

Note 2: the distribution of Octave for Windows contains a nice text editor, which you can invoke with edit as you would under MATLAB.

Windows (with Cygwin)

  • Install the following Cygwin packages: octave, octave-devel, readline, libhdf5-devel, gcc4-g++, gcc4-gfortran
  • Note that package for Octave 3.0.3 has a little packaging bug, which you need to fix by typing the following at Cygwin prompt:

mv /usr/lib/octave-3.0.3/libctave.dll.a /usr/lib/octave-3.0.3/liboctave.dll.a 

Note that graphics are not supported when Octave is run from the Cygwin prompt; you need to use the option nograph in your MOD file. If you want graphics, install the X windows server.

GNU/Linux

For Debian or Ubuntu distributions, see InstallOnDebianOrUbuntu.

For other distributions:

Running Dynare with Octave

First, you should run Octave.

Under Linux, at the prompt, just type:

octave

Under Windows, you should have a shortcut already installed in your Start menu.

It is also possible to run Octave under Emacs.

Then, from Octave, add the path to Dynare with the addpath command, as you would under MATLAB:

addpath REPLACE_WITH_INSTALL_PATH/matlab

It is possible to autoexecute this command at each Octave start by adding it to the .octaverc startup file (under Linux, this file should be put in the home directory; under Windows, it should be put at the root of the user home under Documents and Settings).

Unless you tell it to do otherwise, Octave won't accept the short syntax when typing dynare command. In other words, to run Dynare on ramst.mod, you need to type:

dynare('ramst')

rather than:

dynare ramst

However, you can force Octave to accept the short syntax by typing the following (or by adding it to your .octaverc):

mark_as_command dynare

Current status of Dynare with Octave

  • Deterministic simulation works (tested on ramst.mod)

  • Stochastic simulation works (tested on example1.mod)

  • Bayesian estimation works (tested on arima/mod1a.mod).

    • However:
    • Excel data files are not supported by Octave. A workaround is to convert the file to a text format (more details to come shortly)
    • Diffuse Kalman filter doesn't work (no ordschur function in Octave)

  • Ramsey policy works
  • Results are saved in .mat files which can be read from Matlab 6, 7 and from Octave

  • Graphics display:
    • basically works
    • however window titles ("Priors", ...) don't show up (with GNUplot backend)
    • the scale is sometimes ugly (overlapping characters) (with GNUplot backend)
    • warnings about missing font file show up (with GNUplot backend)
    • graphics are vertically shrinked when several plots are on the same window (with JHandles backend)
    • graphics saving on filesystem works for EPS, but not for PDF and FIG formats
    • currently, Dynare crashes when Octave is run without graphical capabilities; a workaround is to use option "nograph"
  • MEX files:
    • can be compiled using mex/sources/build_octave.m

    • successfully tested under Linux
    • under Windows, since the Octave-Forge pre-compiled binary is build using Microsoft Visual C++ 2008, one need this compiler to create MEX files

Main differences between MATLAB and Octave which are dealt with by Dynare

  • Generalized eigenvalues: eig(A,B) doesn't exist in Octave. A call to lambda = qz(A,B) does the same job, except that it doesn't return infinite eigenvalues, so we can't use it. Implied a change in dr1.m

  • QZ decomposition: [AA,BB,Q,Z] = qz(A,B) works under Octave, but the convention for Q is different. We have AA = Q*A*Z under Matlab and AA = Q'*A*Z under Octave. Implied changes in gensylv/sylvester3.m and qz/mjdgges.m

  • Reciprocal condition number: rcond(A) doesn't exist under Octave. For the moment, the workaround is to create a rcond.m M-file which does 1/(norm(A,1)*norm(inv(A), 1)). The rcond() function is now available in Octave 3.2.

  • Saving data on the filesystem:

    • Octave can read and write Matlab's MAT format. A call to default_save_options('-mat') was added in dynare.m to make Dynare for Octave create MAT files

    • But save() and load() under Octave don't assume the .mat extension. Need to explicitly add them

  • Saving graphics on the filesystem:

    • Saving graphics with saveas() don't work, since it uses a Matlab specific format

    • Creation of PDF files is not supported (through print -dpdf). This comes from the fact that PDF support in GNUPlot is non-free, and therefore not available under Debian/Ubuntu or Windows package. See Debian bug #248426

    • Creation of EPS files works (though file extension is not automatically added by Octave, contrary to Matlab)
  • Warning handling is different between Matlab and Octave, and necessitated some adjustments

  • Adjustments were obviously necessary where version() function is called

  • The operator & under MATLAB is buggy: it doesn't execute its second argument if the first is false, when used in an if statement. This behaviour should be restricted to &&. This also applies to | and ||. Implied a change in mh_optimal_bandwith.m, since this file expects the buggy behaviour

  • waitbar() exists under Octave, but is text-only and is not very flexible. Replaced by calls to printf() in random_walk_metropolis_hastings.m

  • mkdir() works slightly differently under Octave: it won't simultaneously create several depths of subdirectories. Implied a change in CheckPath.m

  • setdiff() doesn't return a second argument under Octave. Implied a workaround in dynare_estimation.m and dynare_estimation_init.m

  • ordeig() doesn't exist under Octave (nor on MATLAB < 7.0.1). Use my_ordeig() instead.

  • Case sensitivity : under Linux, calls to Octave functions and variables are case sensitive. So non preprocessed instructions at the end of modfiles should be written with lowercase.

DynareWiki: OctaveCompatibility (last edited 2012-10-08 11:47:00 by SébastienVillemot)