Do NOT open the archive (.zip or .tgz) file directly. R needs the package to be in this archived format to install properly in Step 5.
R is a freely available statistical software package and programming languange available for Windows, Unix (Mac) and Linux systems. Pmetrics is an add-on package for R. Click the R icon to be linked to the Comprehensive R Archive Network (CRAN) and download the appropriate version for your system.
Although R comes with a basic graphical user interface for writing scripts, there are other options. We prefer Rstudio, which is an excellent cross-platform environment for R. You can get it by clicking their logo. If you prefer to use the native R GUI or another, that is fine too.
Pmetrics needs Fortran to work. We support gfortran, which is free; however, if you have another Fortran installation on your system, email us for help.
Be sure to follow the instructions carefully for your specific system below.
You can also use R scripting, although in Rstudio this sometimes (unpredictably) fails. Type the following command into the R console window (don't know what that means?):
A file chooser window will open and you can select the Pmetrics unextracted archive file that we sent you. On Mac systems, this will be a Pmetrics_xx.tgz file,
and on Windows it will be a Pmetrics_xx.zip file, where xx is the version number, which is currently 1.5.2.
Pmetrics uses Fortran to compile code to run population model fitting and simulations. When you first load Pmetrics in R with the library(Pmetrics) command,
the next command you should run is PMbuild(). This will attempt to compile the required, included, Fortran modules.
There are many Fortran compilers available, so Pmetrics will ask you which Fortran compiler is installed on your system. If you don't have one, you will be linked to a page on our website with
step-by-step instructions on how to get and install a specific version of gfortran (free) for your system. If you neglect to run PMbuid(),
when you first load Pmetrics, then the first time you use a command in Pmetrics that requires Fortran, e.g. NPrun(), ITrun(), ERRrun(), SIMrun(),
you will be asked to supply the type of Fortran compiler you have and prompted to run PMbuild().
As of version 1.2.9, the function PMtest() will allow you to determine if you have installed all the necessary components to run Pmetrics. If you have not
properly installed and loaded Pmetrics, installed and identified your fortran compiler, and run PMbuild(), you will get an error report when you run
To start using Pmetrics, be sure to download the example script, model file, data files, and instruction files from the Example Section.
Do also carefully read the User Manual!
Hopefully, you have been able to successfully install all the required components. Please use the LAPK Forum if you are having problems.
If you are new to Pmetrics, download a zip file containing an example R script, data .csv file, and fortran model file to run Pmetrics.
Unzip the file on your computer.
Put the unzipped Examples folder with its subfolders and files in a new directory called "C:\LAPK\Pmetrics" (Windows) or "~/LAPK/Pmetrics" (Mac). If you don't put it in this folder
you will have to modify the Pmetrics_examples.R file (next point).
Open the Pmetrics_examples.R file in the Rscript folder. It contains commented code to introduce you to Pmetrics.