How to get various bits of software for courses that I teach


JAGS is Just Another Gibbs Sampler. It is a program for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation not wholly unlike BUGS. JAGS was written with three aims in mind: Most program written for OpenBugs will run on JAGS with only minor modifications.

JAGS is available for Macintosh, Windoze, and Linux platforms.

Most people use R to use JAGS and so R and Rstudio should be installed on your machine as outlined elsewhere on this page.

  1. Install R and RStudio on your machine as noted elsewhere on this page.

  2. Install the packages as listed in the R installation instrucitons plus the following packages
         R2Jags,    coda,     digest
    Don't forget to check the box on installing dependencies when installing the packages.

  3. Download and install the latest version of JAGS from JAGS Website.

    To test that the installation is working on a Macintosh, open a Terminal window, and simply type jags If you get a message similar to
        Welcome to JAGS 4.x.x on Tue Feb 10 20:35:14 2015
    then you are ok.


This is available from the SFU ITS site for authorized users.


LaTeX is a (mathetmatical) typesetting program that can be used with R/Rstudio to make turn-key documents that automatically update themselves if new data are added and the R code is re-run.

A brief introduction is available at

LaTeX is available for Macintosh, Windoze, and Linux platforms.

Download the LaTeX program from:


BUGS is a software package for performing Bayesian inference Using Gibbs Sampling. The user specifies a statistical model, of (almost) arbitrary complexity, by simply stating the relationships between related variables. The software includes an ‘expert system’, which determines an appropriate MCMC (Markov chain Monte Carlo) scheme (based on the Gibbs sampler) for analysing the specified model. The user then controls the execution of the scheme and is free to choose from a wide range of output types.

There are two main versions of BUGS, namely WinBUGS and OpenBUGS. OpenBUGS is an open-source version of the package, on which all future development work will be focused. OpenBUGS, therefore, represents the future of the BUGS project. WinBUGS, on the other hand, is an established and stable, stand-alone version of the software, which will remain available but not further developed.

OpenBUGS does not run on Macintosh platforms -- use JAGS instead. Installation instructions are found elsewhere on this page.

Most people use R to access OpenBugs and so R must be installed on your machine as outlined elsewhere on this page.

  1. Install R and RStudio on your machine as noted elsewhere on this page.

  2. Install the packages as listed in the R installation instrucitons plus the following packages
         R2OpenBUGS,    coda,     digest
    Don't forget to check the box on installing dependencies when installing the packages.

  3. Download and install the latest version of OpenBugs from OpenBugs download site

R (and Rstudio)

R is a free (but not cheap) statistical package available for download. Rstudio is the standard integrated development environment (IDE) for using R that most people use with R.

  1. Download the latest verson of R for your machine from The R Project for Statistical Computing or the local (SFU) mirror site.

  2. Install R using the downloaded files. You will need administrator privlidges for your machine.
    Additional (technical) information is available at: R Installation and Administration but you likely won't need this.

    If you are running Windoze, you should delete any earlier versions of R from previous installations. If you running a Macintosh, newer versions of R automatically overwrite older versions of R

  3. Create a personal (package) library. There are many extensions (packages) available for R. The default location for these packages will require administrative access everytime you update a package. Additionally, when you update to a new version of R, you will lose your installed packages unless you have a personal library.

    Here are instruction for Windoze and Macintosh machines. If you have a Unix machine that is not a Macintosh, the instructions will be similar to that from the Macintosh.

    Many corporate and goernment environments "lockdown" computers so users cannot install packages following the step above.
    Here are instruction on how to install packages when you do not have administrative access to your Windoze machine.

  4. Download Rstudio, an integrated development environment for running R, from the Rstudio website.

  5. Install Rstudio. You will need adminstrative access to your machine.

  6. Install the following packages into your personal library using R or Rstudio (you only need to this with either method).

          AICcmodavg,    arm,    binom,    boot,    car,    data.table,    devtools,    dplyr,    emmeans,    EnvStats,    GGally,    ggplot2,    ggforce,    ggfortify,    ggmap,
          gplots,    gmodels,    gridExtra,    hms,    Kendall,    knitr,    lme4,    lmerTest,    lmtest,    lubridate,    multcomp,    multcompView,
          nlme,    plyr,    pwr,    randtests,    readxl,    reshape2,    rkt,    sf    sp    SiZer,    survey    tidyverse    trend

    Instructions on installing packages ONE AT A TIME using R are availble on this video.
    Instructions on installing packages ONE AT A TIME using Rstudio are available on this video
    BE SURE TO CHECK THE BOX ASKING TO INSTALL DEPENDENCIES as some packages depend on other packages.

    You can install ALL of the above packages by copying and pasting the following into the R console once you open RStudio

    package.set <- c("AICcmodavg","arm",
                     "binom",     "boot",
                     "car",       'data.table',
                      "emmeans", "EnvStats",
                     "GGally",    "ggplot2",   
                     "ggforce",   "ggmap",
                     "ggfortify", "gplots",
                     "gmodels",   "gridExtra",
                     "Kendall",   "knitr",
                     "lme4",       "lmerTest",
                     "lmtest",     "lubridate",  
                     "multcomp",   "multcompView",
                     "nlme",       "plyr",
                     "pwr",        "randtests",
                     "readxl",     "reshape2",
                     "rkt",        "sf",
                     'sp',        "spData",
                     "survey",   'tidyverse',

You are now ready to use R and Rstudio. There are many useful on-line manuals on the R site along with much contributed documentation.

CodeSchool has a brief introduction to R that is useful.

The short reference card here is also useful

R Commander (optional)

R Commander is a basic graphical user interface (GUI) for R that provides an overlay with popdown menus and standard analyses. The functionality is provided by the base Rcmdr package and several additional packages with names RcmdrPlugin.xxxx. This type of interface is useful for the occasional user, but you will quickly outrun the available analysis options. For example, R Commander still uses the Base R graphics rather than ggplot. Many users quickly graduate to using the scripting features of Rstudio (above). R Commander will generate scripts for the common analyses that you can then cut and paste into your script to generate a basic script for your analysis. R Commander is compatible with Rstudio and can be used at the same time. It may get a bit confusing because there are now two GUI interfaces operating at the same time.

Installing R Commander.

  1. Read the Installation Notes to ensure that you have the proper additional software needed to run R Commander.
  2. Download and install the Rcmdr package in the usual way (see above).
  3. Download and install the following R Commander plugins (packages) in the usual way (see above):
          RcmdrPlugin.HH,   RcmdrPlugin.mosaic,   RcmdrPlugin.sampling
  4. Launch Rstudio. Navigate and Set the working directory in the usual fashion.
  5. Launch R Commander by typing
    in the Console window.

    When ever you launch R Commander it checks that all other packages needed are available and will offer to install additional packages. Again it is highly recommended that you have a personal R library installed as described above.

    R Commander will open another window with menu options for loading data sets, doing standard analyses, etc.

RMark on a Mac without an emulator

RMark is an R package that calls the MARK optimization engine to fit capture-recapture, occupancy, nest survival, and other similar models.

The MARK program consists of two separate parts -- the user graphical interface which uses Windoze application program interfaces (API) and so can run only under Windoze, and an optimization engine which then actually the model and returns the results to the interface. RMark call the optimization engine only. Consequently, with some work, it is possible to install only the optimiztion engine on the Macintosh and run RMark natively on a Macintosh without the need for a virtualization engine such as VirtualBox.

The following instructions were created by Simon Bonner and follow the thread at Installing MARK on a Macintosh

had to change my shell to zsh before running Bonner's scripts

  1. Install home-brew
    /usr/bin/ruby -e "$(curl -fsSL"

  2. Install gcc
    brew install gcc

  3. Install Mark
    brew tap sjbonner/tap
    brew install mark-on-mac

  4. Check MARK - should return /usr/local/bin
    which mark

  5. Check that mark runs - should return "no input file...."
Everything seem to work now using RMark under Rstudio without any problems! Hurray,,, no more need for a Windoze virtual machine to run RMark!. YMMV.


There are several options for installing SAS while a student at SFU.
  1. Installing the full version of SAS 9.4 (Windoze Systems)

    SAS 9.4 will ONLY RUN ON 64-bit Windoze operating systems (System 7 onwards). SAS is not yet supported on Windoze 10
    See here for a detailed list of supported system. Check carefully to ensure that you do NOT have consumer versions (vs. the pro versions) of an OS.
    Here is how you can check if you are running a 64-bit system.

    1. Download SAS from the SFU ITS site.

      The download for SAS is HUGE (10 Gb)! It will likely take SEVERAL HOURS to download. Start now before the network at SFU gets clogged with returning students. Installation will also take about 120 minutes.

      The password to unlock the download is given on the ITS webpage where you found the software.

    2. Follow the instructions given on the ITS page and the links below. When you come to the list of modules to install in SAS, be sure to click to ALSO INSTALL the ODS Graphics Editor, IML Studio, and the POWER/SampleSize modules.

      Instructions on installing SAS 9.4. Obviously, don't email the University of Massachussetts for help or information!
      Instructions on installing SAS 9.4. Obviously, don't email Cornell University for help or information!

    3. You may notice that SAS 9.4 does not display the files created by ODS PDF properly. Here is how to fix this problem.

  2. Installing the full version of SAS 9.4 (Macintosh Systems)
    SAS does not run on Macintosh platforms. While there is a Unix version of SAS, SFU only has a site license for the Windoze version of SAS.

    So... to use SAS on a Macintosh you will have to do the following. [I have a Macintosh and this is what I do.]

    1. Download and install VirtualBox. Free at the VirtualBox website..
    2. Purchase a copy of a Windoze operating system such as System 7 or System 8.
    3. Start VirtualBox, create a new 64-bit virtual machine, and follow the instructions to install the operating system you purchased above. Be sure to allocate at least 100 G for the virtual disk for your new machine. [Don't worry, the initial size of the virtual machine will not be 100 G -- it only uses disk space as it needs.
    4. Be sure to enable the Virtual Box Additions so that you share the clipboard between the Mac and Windoze machines.
      This explains how to do this

      You may also wish to enable shared folders so that you can access you Mac files from the Windoze machine.
      This video shows how to set up shared folders.

    5. Download and install SAS on your Windoze Virtual machine following the instruction for Windoze above.

  3. Installing SAS University Edition (Windows or Macintosh or Linux)
    SAS University Edition is a FREE mini-version of SAS especially designed for academic use. It features a new editor to help write SAS programs and has improved functionality for typical academic usage.

    The SAS University Edition is available for Windows or Macintosh or Linux systems.

    Follow the installation instructions at the SAS Installation Guide for the University Edition

    If you previously installed the University Edition, consult the installation examples on how to upgrade your installation.

After you have installed SAS, run the sample program as described at guide to running your first SAS program
[ SFU Statistics and Actuarial Science Home | SFU Home]
Email comments or suggestions to Carl Schwarz (
© 2020 Carl James Schwarz Last updated 2020-01-12.