Using Commander to Teach Intro Stats Gilles Lamothe [email protected]

Department of Mathematics and Statistics Faculty of Science University of Ottawa

Using R Commander to Teach Intro Stats – p.1/11 Content • What is R? What is R Commander? • Installation and loading R and R Commander • Working with common probability models • Importing Data • Categorical versus Numerical • Descriptive Statistics and Graphs • Generating data from known models • Regression • Association between categorical variables

Using R Commander to Teach Intro Stats – p.2/11 What is R? • R was developed at Bell Laboratories (formerly AT& T, now Lucent Technologies) by John Chambers and colleagues. • It is free and can be downloaded from CRAN (Comprehensive R Archive Network). • Syntax is similar to S. • It is a command based language. • It is an interpreted language (i.e. no compilation). • It works on many platforms: Windows, MacOS, and a wide variety of Unix/Linux platforms. • It does not come with a nice graphical user interface.

Using R Commander to Teach Intro Stats – p.3/11 What is R Commander R Commander (Rcmdr) was developed by John Fox from MacMaster University. He has a paper in the Journal of Statistical : http://www.jstatsoft.org/v14/i09/paper Design Objectives: • Provide an easy to use, cross-platform, GUI to teach introductory statistics courses. • Make it difficult to do unreasonable things (e.g. Compute the mean of a categorical variable). • To render visible the association between the choices that we make in the GUI and the commands that they render.

Using R Commander to Teach Intro Stats – p.4/11 Installation and Loading • Download R from CRAN, refer to http://www.r-project.org/ • Install R and launch R to use Rcmdr. • Install the Rcmdr package. Follow: Packages->Install Packages. • Loading Rcmdr. Follow: Packages->Load Packages. • Alternative Loading. Use the command: library(Rcmdr)

Using R Commander to Teach Intro Stats – p.5/11 Common Probability Models • Computing probabilities. • Finding quantiles. • Plot distributions. Choose Distributions in the menu.

Normal Distribution: µ = 0, σ = 1 Density 0.0 0.1 0.2 0.3 0.4 −3 −2 −1 0 1 2 3 x

Using R Commander to Teach Intro Stats – p.6/11 Overlayed Plots Rcmdr does not produce overlayed plots.

Follow the link http://aix1.uottawa.ca/~glamothe/t.html to obtain an R program to produce overlayed t distributions.

Using R Commander to Teach Intro Stats – p.7/11 Inputting Data Rcmdr can input data from various type of data files: • Minitab, SPSS • Excel • Text Files (.txt) We suggest that you use tab delimited text files since they work across all platforms.

Select: Data->Import Data

Using R Commander to Teach Intro Stats – p.8/11 Descriptive Statistics Rcmdr considers two types of variables: numerical and categorical.

The type of the variable restricts the commands that can be used.

Rcmdr assumes that we are working with data arrays (i.e. raw data).

Rcmdr does not work with summary data.

We can recode and transform variables. Choose: Data->Manage variables in active dataset

Using R Commander to Teach Intro Stats – p.9/11 Simulation Choose Distributions to find the distribution.

Rcmdr assumes that you want generate data from a sampling distribution.

The rows are the samples and the columns are the observations.

Main Purpose: Illustrate the CLT.

Using R Commander to Teach Intro Stats – p.10/11 Inference Choose Statistics and make your choice according to the type of inference.

• Contingency Tables • Means • Proportions • Fit Models

Using R Commander to Teach Intro Stats – p.11/11