Math 6040/7260, Fall 2013
Linear Models
Page 1 of 2
Exploring Linear Models in R
Fitting a simple regression line.
The R dataset faithful provides 272 observations of eruptions lengths and time between
eruptions for the Old Faithful geyser in Yellowstone
Math 6040/7260, Fall 2013
Linear Models
Page 1 of 4
Visualizing Density Functions
The simplest function for producing a graphic in R is called plot. It has a lot of options, and
well just explore a few of them now. To start, lets consider the basic normal
Math 6040/7260, Fall 2013
Linear Models
Page 1 of 5
Testing Linear Model Hypotheses
Well begin by walking through Exercise 2.10.3 (p. 47). This involves fitting the model
y i 1 xi1 2 xi 2 ei , ei ~ N (0, 2 ). The data are provided in the text, but to get
Math 6040/7260, Fall 2013
Linear Models
Page 1 of 2
Variable Selection
Our primary dataset for today is the road dataset located in the MASS package. This dataset
includes the following variables:
state: name
deaths: number of annual deaths in car acciden
Math 6040/7260, Fall 2013
Linear Models
Page 1 of 3
Checking Model Assumptions
Well need to load two packages to get started. The first is MASS, which is already installed
in your base package, and the other is car (not a vehicle, but an acronym for Compa
Math 6040/7260, Fall 2013
Linear Models
Page 1 of 5
Matrix and Vector Operations with R
When you start R, youll see a window that says R console with some text and a command
prompt. From here, you need to know some commands to be able to make anything hap