16466 hits since June 13, 2007


A program for simple random regression analyses via Gibbs Sampling

Random regression (RR) models have become a popular choice for the analysis of longitudinal data or 'repeated' records. Typically, analyses require numerous parameters, i.e. (co)variances between RR coefficients and measurement error variances, to be estimated, especially if the model of analysis includes additional random effects such as maternal effects. Programs for RR model analysis using restricted maximum likelihood (REML) are available. However, the high computational demands of REML analyses for RR models severely limit the feasibility of RR analyses for data sets sufficiently large to support estimation of the pertaining (co)variance components, in particular for models fitting many RR coefficients.

Bayesian analyses using Gibbs sampling provide an alternative which is markedly simpler to implement than REML. Whilst the range of models which can be accommodated via Gibbs sampling may be more restrictive and the total computing time required may be longer than for corresponding REML analyses, memory requirements are substantially less. Hence Bayesian methodology readily facilitates large scale analyses. Apart from these practical advantages, of course, it provides estimates of complete sampling distributions rather than just simple point estimates.


RRGIBBS performs a single task : the analysis of a simple class of RR models using Bayesian methodology. Models may involve :

Model specification is via a parameter file. The run time behaviour of RRGIBBS can be modified by a number of command line options. RRGIBBS is a 'no-frills' program. It basically offers little more than a reasonably efficient Gibbs sampler for a range of random regression analyses. The main output are files with the successive samples of (co)variance components drawn, ready for your favourite post-Gibbs analysis. In addition, limited summary information is produced, including estimates of covariance matrices among RR coefficients and measurement error variances obtained as means over samples (after 'burn-in'), and approximate 95% highest posterior density regions.

Computing environment

RRGIBBS is written in standard Fortran 95 and self-contained, except for routines to generate random numbers. The source code is available for downloading. Compiled versions are available for : Linux, Compaq Alpha stations and SUN work stations.


RRGIBBS is available free of charge to the scientific community under the conditions that it remains my copyright, that it is not modified other than to adapt it to the local computing environment or for personal research, and that its use is credited in any publications.


  • While every effort has been made to ensure that RRGIBBS does what it claims to do, there is absolutely no guarantee for its correctness.
  • You are using RRGIBBS entirely at your own risk, and there is no user-support service.


Meyer, K. (2002). RRGIBBS - A program for simple random regression analyses via Gibbs sampling. Seventh World Congress on Genetics Applied to Livestock Production, Montpellier, France, August 19-23, 2002, Paper No. 28-27, 2pp. View summary - Download paper (2 pages, pdf file, 0.1Mb)

Source code

The FORTRAN source code for RRGIBBS (together with a Unix Makefile) has been packaged into a Unix 'tape archive' and compressed using 'gzip'. It can be downloaded as
RRGibbs.tar.gz (70 KB, 1892 downloads since 18/6/2007). As distributed, RRGIBBS is set up to use routines from the RANDLIB90 package from the Department of Biomathematics of the M.D. Anderson Cancer Centre at the University of Texas to the obtain random samples required by the Gibbs sampler. If you choose to use this software, download source code, documentation and installation instructions from : www://

Compiled versions

  1. LINUX : RRGIBBS for Linux has been compiled under Red Hat Fedora 2, using the Lahey/Fujitsu FORTRAN 95 compiler (version L6.20c). Download : RRGibbs.Linux.gz (391 KB, 1275 downloads since 19/6/2007).
    Updated to accommodate sparse basis functions such as B-splines.
  2. LINUX 64-bit version: compiled under Red Hat Fedora 5, using the Pathscale F95 compiler (version 2.4, 2006). Download : RRGibbs.Linux64bit.gz (879 KB, 0 downloads since 19/11/2007).
  3. COMPAQ Alpha station : RRGIBBS has been compiled for a Compaq True64 work station, using the Compaq FORTRAN compiler (V5.5-2602; UNIX V5.1A) : Download : RRGibbs.Compaq64.gz (1.07 MB, 690 downloads since 19/6/2007). - Updated to accommodate sparse basis functions such as B-splines. A corresponding file for a 32 bit machine, compiled using the Compaq FORTRAN compiler (V5.3-915) is available as : RRGibbs.Compaq32.gz (901 KB, 987 downloads since 19/6/2007).
  4. SUN work station : A Solaris version has been compiled using Sun Workshop 6 Fortran 95 6.0 on a SPARC Ultra work station. Download : RRGibbs.Solaris.gz (233 KB, 1253 downloads since 19/6/2007).


The manual for RRGIBBS comprises more than 30 A4 pages. It is available as a PDF file. Download : RRGmanual.pdf (172 KB, 3601 downloads since 19/6/2007).

Worked example

The worked example provided is the same as for program DXMRR (in DFREML). Download : Example.tar.gz (23 KB, 2173 downloads since 19/6/2007).

Auxiliary stuff

A small FORTRAN 90 program to calculate the values of covariables when fitting B-splines basis functions (run with command line option -u for an outline of its use, option -h for valid command line options).
Download bsplines.f90.gz (2 KB, 2969 downloads since 19/6/2007). or a pre-compiled Linux executable bsplines_lnx.gz (191 KB, 1205 downloads since 19/6/2007).
A tiny FORTRAN 90 program to calculate translate the binary file of Gibbs samples (samples.rr) into a formatted file (Samples.out).
Download bin2out.f90.gz (409 B, 2843 downloads since 19/6/2007). or a pre-compiled Linux executable bin2out_lnx.gz (5 KB, 2803 downloads since 19/6/2007).