You are on page 1of 10

MOOC: Introduction to Probability and Statistics

Part I: Downloading and setting up R/Deducer *For those students who only want to download R and experiment with the program, please see the end of this document for download instructions Step 1: Downloading and setting up Deducer Deducer is a popular and powerful GUI for R that allows users to perform statistical analyses and graphing functions without any coding. You can think of Deducer as the dashboard of your car, and R as the engine doing the work. For this course, we will be using R almost exclusively through Deducer. To set up Deducer, go to the following link: www.deducer.org and follow the instructions to (Start by clicking on Download and Install). After selecting the correct operating environment, follow the specific steps listed. Please note that once the files are downloaded and installed, you can just copy and paste the relevant code from the website into the R Console window and hit enter to execute the commands. Important: When you see a Console and Data Viewer window, go to the 'Packages & Data' menu option, select 'Package Manager', and check the 'default' box next to Deducer. Deducer will now open every time you open JGR (Jaguar), meaning JGR = Deducer. Notes:
1. Deducer requires Java to run. If your machine doesnt have Java, install it by visiting http://www.java.com/en/)

2. For Windows users, please run JGR as an administrator to ensure that you have the required permissions. You can do this by right-clicking on the JGR icon and selecting Run as administrator) Deducer is a shortcut to typing out code using the correct R syntax. If youre interested in learning the R coding scheme/syntax, you can use Deducer to help you. Every time you do something in Deducer, it generates the corresponding code in the R console window and executes it. You can refer to this code to learn how to do things strictly through programming.

It is also important to realize that because Deducer is simply an interface, you can always check the R Console window for notifications and/or error statements from R regarding your tasks. Part II: Opening and inspecting Excel data in R Step 1: Importing Excel data In the Data Viewer window of Deducer, click on File -> Open Data. Select the Excel file that you would like to open. Deducer will open up the data in a spreadsheet format for you. Note that there are several data formats that Deducer can open, including the .csv format. You should see something like this on your screen:

For those using Mac OS X, you may encounter an error involving the package XLConnect when trying to import data in Excel format (.xls or .xlsx). This error will be highlighted in red in the Console window. If you encounter this error, take the following steps: 1. 2. Type install.packages("rJava") into the console and hit enter Type install.packages("XLConnect", type="source") into the console and hit enter

Windows users may encounter a similar problem, in which case you should use the following code:

1.

Type install.packages("XLConnect") into the console and hit enter.

This should install the necessary packages and resolve the problem. Step 2: Inspecting the data Note the following: 1. Cells with missing data have a small NA in them. 2. Deducer allows you to edit data like you would in MS Excel. Try changing the values of some cells to see this. Note: This is extremely risky behavior and is strongly discouraged for real analyses. 3. You can switch from the Data View tab to the Variable View tab if you want to (a) rename a variable or (b) change the variable type (e.g., Change from float to integer, etc.) Part III: Generating Histograms and Box Plots Histograms 1. In the Console window, click on Plots -> Plot Builder to open up the Deducer plotting tool:

2. Double click on histogram. This will open up a window that will ask you to select the variable whose histogram you want to see. Select a variable (for instance, coffee), click on the blue arrow, and then click on OK to generate the histogram:

3. You can save the generated histogram by clicking on Run. You can also edit the histogram by clicking on the Edit component button near the bottom right of the window. Box Plots 1. In the Console window, click on Plots -> Plot Builder to open up the Deducer plotting tool:

2. Double click on simple boxplot. This will open up a window that will ask you to select the variable whose box plot you want to see. Select a variable (for instance, Milk), click on the blue arrow, and then click on OK to generate the box plot.

3. You can save the generated box plot by clicking on Run. You can also edit the plot by clicking on the Edit component button near the bottom right of the window.

Part III: Generating Descriptive Statistics 1. Click on Analysis -> Descriptives in the Console Window. 2. In the new Descriptives window that opens up, select the variable you want to analyze (say coffee):

3. Next, you can choose what descriptives you want to display:

4. You can also define your own descriptives by clicking on Custom. For instance, the following will define a new variable called Inter_quartile_range:

5. Once you are done selecting the descriptives, click on Run, and you will see the output in the Console window:

Downloading and installing R We will begin by downloading and installing R, a powerful and free statistical computing program, from the Comprehensive R Archive Network (CRAN). This includes a basic R installation, along with additional packages for special statistical techniques, graphing, etc. Download from CRAN by going to http://cran.r-project.org/. 1. Windows Users: Click on Download R for Windows. Click on the base sub-directory link, and then download the installation file for R 3.0.0. Install R by double-clicking on the file once the download is complete, and by following the instructions of the installer. Note that the 32-bit version of R should be installed and used for 32-bit Windows, and the 64-bit version for 64-bit Windows. You can find out what version your Windows is by following the instructions found here: http://windows.microsoft.com/enus/windows7/find-out-32-or-64-bit 2. Mac Users: Click on Download R for (Mac) OS X. Download the installation file from the link labeled R-3.0.0.pkg. Install R by double-clicking on the file once the download is complete.

You might also like