Installing R and add-on packages for Propensity Score Matching
R is a free statistical package that can be downloaded and installed from the website: http://www.r-project.org. Once you get to the website, go to the first bullet under the heading “Getting Started” and click on download R. You will be directed to a page titled “CRAN Mirrors.” Click on the URL representing a location that is closest to you. You will then be directed to a page with download links for Linux, Mac OS X and Windows.f you are a Windows user, follow these steps:
Windows
- Click on the “Download R for Windows” link. Next, from the page titled “R for Windows,” click on the “base” link.
- Click the “Download R 2.14.2 for Windows” link (or the link for the latest version of R) and the installer (.exe file) will be saved to your “Downloads” folder under “My Documents.”
- Double-click on the .exe file in the “Downloads” folder to install the software (keep the default settings for the installation).
- Select “Finish” once the R program has completed installation.
- Open the R console by clicking on the R icon on the desktop or by going to “All Programs/R/R 2.14.2” under the Start menu.
For the propensity score matching exercise, we suggest that you install four add-on packages written in R. To install the packages, carefully type each of the following four scripts (A through C, below), one at a time, after the “>” symbol in the R Console window, then press “return” or “enter” on your keyboard.
- install.packages(“MatchIt”)
- install.packages(“Zelig”)
- install.packages(“optmatch”)
When you enter the first script, a window will pop up asking you to select a CRAN mirror. Select a location and the first package will begin loading. Please be sure to match the punctuation and capitalization exactly.
Additional Resources
Macintosh
- Go to: http://www.r-project.org and click “MacOS X.”
- Click R-2.14.0.pkg (or the latest version) to download the installer package file to your download folder.
- Once the installer package file is downloaded, double-click on the file. An installation window titled “Install R 2.13.0 for Mac OS X 10.5 or higher (Leopard Build)” will open.
- Click “continue” then “continue” then “agree” to the terms of the software license agreement, then click “Install” and verify the password for your computer.
- Wait for the message “Install Succeeded.” Go to your application folder and double-click the R icon to open the R Console window.
For the propensity score matching exercise, we suggest that you install four add-on packages written in R. To install the packages, carefully type each of the following four scripts (A through C, below), one at a time, after the “>” symbol in the R Console window, then press “return” or “enter” on your keyboard.
- install.packages(“MatchIt”)
- install.packages(“Zelig”)
- install.packages(“optmatch”)
When you enter the first script, a window will pop up asking you to select a CRAN mirror. Select a location and the first package will begin loading. Please be sure to match the punctuation and capitalization exactly.
Additional Resources