/ jansonius / scientific software / njstat

NJSTAT: rather complete free statistical program for DOS (and Linux and Windows)

During my education, I attended several courses on statistics and epidemiology; NJSTAT is essentially the result of coding the lecture notes in Fortran. Consequently, NJSTAT covers the majority of commonly used statistical tests.

NJSTAT for DOS should run on any 8086 compatible computer with or without mathematical coprocessor (8087). See below for linux and windows ports.

Type njstat to start the program:

NJSTAT itself can only handle ASCII datafiles (plain text files) with a limited number of columns. Therefore, a text editor that can perform column block operations (for example ZED) should be used as a supplement to NJSTAT. NJDATA can be used to manipulate ASCII datafiles (transform columns, combine columns, sort rows, remove missing values). In Linux or Windows, data can also be copied and pasted from a spreadsheet into a text file.

NJSTAT doesn't have any graphical output. To view a histogram (as part of descriptive statistics), an x-y scatter plot (prior to simple linear regression) or a plot of residuals against fitted values (after multiple linear regression), NJPLOT can be used. For more sophisticated - publication ready - plotting, GNUPLOT can be used. For multiple linear regression, use NJMREG.

NJSTAT does not provide P-values (but rather t, F, chi-square, etc.). Tables for retrieving P-values can be found in most statistical textbooks; tools can be found anywhere on the internet or here.

NJSTAT in Linux and Windows

Linux is able to run NJSTAT: the source code, included in the zip file, can be compiled in any Linux distribution containing a fortran compiler. In Ubuntu Linux, you can install the gfortran (g77 in older distributions) compiler with:

  sudo apt-get install gfortran

Now you can compile NJSTAT by typing in a terminal (switch -static makes the binary larger but allows for running the njstat executable on a computer without fortran compiler):

  gfortran -static -o njstat NJSTAT.FOR

Next, copy the resulting binary njstat from your home directory to the /usr/bin directory:

  sudo cp njstat /usr/bin/

And make the binary executable:

  sudo chmod a+x /usr/bin/njstat

To use the program, open a terminal and type:


You may also run the binary (njstat in the archive) directly from your home directory by typing:


Please remember that Linux filenames are case sensitive: njstat.for and NJSTAT.FOR, for example, are not interchangeable!

In Windows, the executable NJSTATWIN32.EXE can be used. This version was compiled in wine using the g95-MinGW.exe compiler:


That's all Folks!

latest update: 19-1-2019