Computing Health Expectancies using IMaCh

(a Maximum Likelihood Computer Program using Interpolation of Markov Chains)


May 2022

Authors of the program: Nicolas Brouard, senior researcher at the Institut National d'Etudes Démographiques (INED, Paris) in the "Mortality, Health and Epidemiology Research Unit"

with the collaboration of Agnès Lièvre (former PHD student at INED) until 2007

Contribution to the mathematics: C. R. Heathcote (Australian National University, Canberra).

Contact: Nicolas Brouard (

 Main publications concerning the method are:

  • Lièvre A., Brouard N. and Heathcote Ch. (2003) Estimating Health Expectancies from Cross-longitudinal surveys. Mathematical Population Studies.- 10(4), pp. 211-248. DOI 10.1080/713644739
  • Nicolas Brouard (2019) - Chapter 10 - Theory and Applications of Backward Probabilities and Prevalences in Cross-Longitudinal Surveys. In Handbook of Statistics, Elsevier, Volume 40, edited by: Arni S.R. Srinivasa Rao, C.R. Rao, Pages 435-486, ISSN 0169-7161, ISBN 9780444641526, DOI 10.1016/ or on
  • Forthcoming training workshop on IMaCh on September 19-20, 2022 in Halifax (Canada). Call for Applications

    Training workshop on IMaCh on September 19-20, 2022 in Halifax. To be done

    Training workshop on IMaCh on May 25th 2021 3pm to 5pm (Paris CET, UTC+2). Already done

    Download and instructions for installation

    Current versions July 2022

    The grapher that IMaCh uses is gnuplot from Gnuplot has evolved since version IMaCh 0.98k and therefore you need at least Gnuplot 5. Otherwise you need to adapt the .gp file produced in order to run with your old gnuplot. With the installer provided for OS/X and Windows, a recent gnuplot binary is provided and will be installed on the same directory that the IMaCh binary. It is better to use your own Gnuplot installation and IMaCh will test the command '''gnuplot''' but if the binary in not in your path, it will make a first error but, in a second attempt, will use the binary provided by the installer. You can also add the gnuplot binary in your path.

    On Windows (XP, Vista, Windows 7, Windows 8, Windows 10, Windows 11)

    Until June 2004 the installation did consist in a zip file which had to be extracted in the directory of your choice. But with version 0.98d and above IMaCh we are using a windows installer (Inno setup 5.5.5).
    In order to facilitate the use of IMaCh we associated the .imach extension to two features: editing and running. Thus by right clicking on a foo.imach file you can either 'edit'the file (default) with the notepad editor or 'run' it with gnuplot (you need a recent version).

    You need to have the Administrator privileges to install the software. We don't propose anymore an installation which does not alter registry because we think that you all have access, even temporarly, to Administrator privileges (usally by right clicking the .exe you can choose "Install with Administrators privileges".

    Imach version 0.99r30 of July 2022 can be downloaded below as a setup.exe file imach-0.99?-#-setup.exe. The ? corresponds to a version number while the # might correspond to same program but compiled differently.
    After having tested crosscompilations from a Unix box we moved to native versions compiled with Visual Studio Express compiler 2013 32 and 64bit bits) and, better, Intel C/C++ compiler from the package Intel® Parallel Studio 2015 The IMaCh program and gnuplot will be installed in the directory of your choice (usually in Program or Program Files). Please check the corresponding md5sum (if provided), if the download is corrupted.
    After installation, a right click on a .imach file lets you edit with the notepad text editor (which is less useful than other text editor like workpad but which have the advantage to be installed on any Windows).

    Very old (historical) Windows versions are accessible here.

    On Mac OS/X Lion and higher)

    IMaCh can be easily compiled with Apple LLVM on MacIntosh as soon as XCode (free download from Apple) is intalled on your MaCIntosh.

    It take a litle more time to get version of Gnuplot 5+ for Mac OS/X and to compile it on a MaC. Currently graphs are output as svg because the svg format is scalable and thus figures are easier to improve and to insert in other documents. Sometimes the svg file is to big and is replaced by a png binary file. But you can get any other format with gnuplot (for example, on Emacs with gnuplot-mode, just edit the .gp file, send the first "cd " line to change to current directory, move to corresponding line of the plot, send the plot line to gnuplot, visualize on the screen, change the terminal as well as plot file names).

    You can download below a dmg file, for example imach0.99X.dmg and install it. Like on Windows, two sub-directories are created bin and html . In the bin subdirectory you will find two executables imach itself and gnuplot. With recent versions, this tree is embedded in an Application. Be careful, that this version of Gnuplot is compiled with the Aquaterm App (which is no more distributed by Apple) which has to be installed by yourself. You can google for "Aquaterm dmg" and find one at sourceforge and install it. The aquaterm library is required by the currently included gnuplot package (even if imach doesn't use an aquaterm terminal, but .png and .svg mostly).

    You need to click on imach application and IMaCh will be launched in a Terminal window, asking you to enter the name of a parameter file. A parameter file is a text file with an extension .imach (but you can use a .txt extension if you want. Among the parameters required, a data file name has to be entered. It can be a relative file name like ../../data/data1.txt.
    If you open a new finder you can drag an IMaCh parameter file into the terminal IMaCh Window that you just created.

    At the end of the run, and it order for the terminal window not to disappear, the program will prompt for a command like "e" for editing/viewing the results (with your browser) or "q" for quit.
    You can use the finder or browser (there is no more difference now) and click on the main .html (or .htm) file created. The name of this main html file is the same name as your parameter file, only the extension .imach is changed to .html. If you slightly change the parameters, you just have to give another name and the new results will not override the former.

    On Linux

    Gnuplot is distributed on most distributions. Just verify that your version of gnuplot is version 5+ . I have had time to make a rpm yet, but you can have a look at the CVS tree and compile the sources.

    If you want to have a look at the history of the souces, you can look at the unique imach.c C program and to its history (since year 2000). Unfortunately for you, Agnès Lièvre and myself (yet alone) haven't highly documented the history. The CVS tree is mostly a way to save temporary, non working versions!

    The IMaCh program consists in nearly one single big file of currently 13,000 lines of C code and the main is at the very end. This wasn't an accurate way of programming when memory was short and CPU slow; at that time softwares were supposed to be splitted into subroutines belogonging to different physical files but linked together by the load step. But today, I appreciate having all subroutines and functions within the same imach.c software. Also there are a lot ifdefs in order to reproduce the various versions of IMaCh thus look at the Makefile and, on Linux, compile with make _linux=1 imach and you should be able to get the binary.

    Remarks concerning the Linux versions are similar to the Mac OS/X version. You will get a desktop Icon which will open the imach program in a Terminal window.

    An IMaCh GUI is planned after we moved the old CVS tree from INED to a more modern git site.

    Old 0.99r14 You can download below a binary rpm file for a 64 bits Linux, for example: imach-0.99r30-1.x86-64.rpm

    The Windows binaries have been compiled with native Intel Compiler from an OS/X Virtual Box and a Windows 7 64bit. Each binary contains two directories bin, html/doc and now a third directory tests with more complex examples. In the bin subdirectory you will find the imach executable and in html/doc the biaspar.imach test parameter file and its corresponding data file data1.txt. In order to run the test the command is ./bin/imach ./html/doc/biaspar.imach

    gnuplot should be installed otherwise at the end of the run (optimization and calculations last at least 7 minutes on today most efficient hardwares) the command gnuplot will fail. If successful, typing e will open biaspar.htm with your browser and all the results including graphs generated by gnuplot will appear.

    Differences between efficiency of binary versions, related to former errors in the likelihood optimizations algorithms, have be discussed at REVES 2015 meeting in Singapore.

    Download (Old download) and bugs reported

    Click here to access to the detailed documentation


    In addition to INED, this software have been partly granted

    Our work is copyrighted as a GNU software product, i.e. program and software can be distributed freely for non commercial use. We used some codes from the first book "Numerical Recipes in C" (Press et al, 1992) which is copyrighted. Today, the code of the optimization programme has been so altered and many bugs have been fixed, see communication at the 2015 REVES meeting in Singapore) that we consider that we are only in debt of the algorithm which has been published.

    Latest documentation can be accessed on the wiki at

    There is a public mailing list of IMaCh's users. You can subscribe by sending a mail to (and unsubscribe with for help, comments and reports on the performance (see the Performance section of the wiki). Archives can be accessed at

    If you ask for help, it is usually easier to send the parameter file, the .log file as well as some records of the datafile.

    IMaCh Wiki

    As discussed at the REVES meeting in Beijing, we created a Wiki for IMaCh were people having used IMaCh (or having not been able to use it because of obscure or unadequate features) can add tips and discuss various aspects of IMaCh and interface with other statistical softwares. In many aspects, our "official documentation" is not accurate enough.

    Wikis are a promising way to give information closer to your expectations. It also a very dynamic movement if you consider the first International Wikimedia Conference in Francfurt (August 2005), where most Wikis were represented and in particular Wikipedia.

    Access to the IMaCh Wiki

    . Please ask for a username and password.
    $Id: index.htm,v 1.19 2017/06/29 11:18:21 brouard Exp $