School of Statistics

Image of Goldy Gopher and link to School of Statistics

Wordmark of and link to University of Minnesota
Applied Linear Regression, 3rd Ed.
using R

You need to get the primer for R and install the R package; other material is optional. Instructions are given below.

Text downloads (.pdf files)

  1. Get the R primer that shows how to use R to do the computations discussed in the book. The primer was slightly revised on September 17, 2009, and this version no longer includes Splus. You can also get R scripts that will do everything in the primer.
  2. Get RSscripts.zip, a collections of scripts for use with R that reproduce most of the computations shown in the book.
  3. Documentation for the functions in the alr3 package is included with the package, but you can download the function documentation separately.
  4. Documentation for data sets is also included with the alr3 package, but you can download the data set documentation separately.

The alr3 package for R

If you are running R, connected to the internet, and have write privileges on your computer's disk, you can install alr3 by typing the following command into the R command window:

> install.packages("alr3")

You may be prompted to select a location for the download; pick a site close to your home. After this, the package should install itself. You do not need to install again unless you install a newer version of R.

If you don't meet the criteria of the last paragraph, you can go to the page for your computer type:

To use the alr3 package, start R. If the package is in the standard location, type

> library(alr3)

If the package is somewhere else, you will need to provide the complete path to the package directory, for example on Windows, you might type library(alr3,lib.loc="E:\Rlibraries"), if you have created the package directory on a removable "E" drive.

As of the version of alr3 available on September 15, 2009, all the data files are immediately available when you load the alr3 package. For example,

> names(forbes)

will give the names of the variables, and

> m1 <- lm(Lpres ~ Temp, data = forbes)

will fit a linear regression. If this does not work for you, you should either get a newer version of alr3 using the Update packages option on the Packages menu, or use data(forbes) before you try to use the data. More information on using the package is available in the
primer.

Getting back to the website

If you are connected to the internet, the function alrweb() in the alr3 package will open your browser and get you back to this website. Assuming you have a pdf reader, alrprimer() will open the primer, and alrerrata() will open the Errata.

R resources

From www.r-project.org, the home for R, you can get a wealth of information about R, including books and other documentation, access to CRAN (pronounced "see-ran"), which includes the program and many add-on packages, and other interesting stuff. The help files available from the Help menu of the program can also be useful.