Additional installation instructions for Mac users

I have a Mac, so I figured I would post some notes on software installation specific to Mac users, from my own experience, to supplement Jacob’s instructions here. Regardless of which operating system you’re using, I encourage you to run the test models in step 4 to check that everything has installed correctly. If possible, please do this before Tuesday, so we have a chance to troubleshoot with you before class if you run into trouble.

1. Install R

Mac users click here (for PC and Linux, see the links here).

This downloads the installation package file. Click on it in your downloads folder to open the file. This opens the install wizard thingy.

Read the stuff and click “Continue” a bunch.

Check that it worked. Either click on the R logo in your Applications folder to launch, or open a terminal and type “r”, then hit enter. You should see something like this:

R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin10.8.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. 

2. Install JAGS

Mac users click here

This downloads the installation package. Click on it in your downloads folder to open, and then click on the package installer that appears in Finder (“JAGS 3.3.0.pkg”). This opens the install wizard thingy.

Read the stuff and click “Continue” a bunch.

Check that it worked. You will NOT see an application called JAGS in your applications folder. JAGS just runs in the background and talks to R. To check that it installed correctly, open the terminal and type “jags”, then hit enter. You should see something like this:

Welcome to JAGS 3.3.0 on Sat Jan 11 01:29:42 2014 JAGS is free software and comes with ABSOLUTELY NO WARRANTY Loading module: basemod: ok Loading module: bugs: ok 

If you’re not comfortable using the terminal, you can skip this and just check that all three programs are working together at the end (step 4).

3. Install rjags (and R2jags, if you like)

You install rjags (and R2jags) from within R. Open R, and then type

install.packages("rjags", dependencies=TRUE) 
install.packages("R2jags", dependencies=TRUE) 

and hit enter after each. If it asks you to select a CRAN mirror, pick “USA (OR)”. This will run installation scripts.
Check that it worked. In R, type

library(rjags) 

You should see something like this:

Loading required package: coda Loading required package: lattice Linked to JAGS 3.3.0 Loaded modules: basemod,bugs 

4. Check that everything is working.

Run a test script for one or two simple models.

Test 1: Download the program files from Kruschke’s book from here. You will need to set the working directory for R to that folder using setwd().

Open the file “BESTexample.R”. Select all of the text, and run it. It may take a little while. At the end, you should see several pretty graphs pop up.

Test 2: Another test, using R2jags instead of rjags (Note that for this script to work, you have to run “install.packages(“R2jags”, dependencies=TRUE)” first, if you haven’t already):

Download the R script (“example jags.r”) and JAGS model file (“Rate 1.txt”) in this folder, taken from the Lee & Wagenmakers text. You will need to edit the R script to set your working directory to the folder where the JAGS script is saved.
Open the R script, select all, and run. If it runs correctly, you should see a histogram of the parameter “theta” pop up.

If you’re getting an error about x11, you may need to install xquartz (http://xquartz.macosforge.org/landing/). Do that, and then try running it again.

If you can’t get at least one of these models to run, please email Rose or Jacob right away. Sometimes it’s tricky to get these programs to work. For this reason, it is a really good idea NOT to wait until 10 minutes before we meet to start installing software.

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>