Simple Linear Regression

WC Hoh
June 18 2016

Slide 2

Simple Linear Regression Model:

Defines relationship between a dependent variable, and

a single independent predictor variable.

The equation for this relationship:

y = a + bx

y: dependent variable

x: independent predictor variable

a: intercept(value of y when x=0)

b: coefficient that shows change in y given an increase in x

Slide 3

Applying Simple Linear Regression to a Diamond Dataset

The diamond dataset consists of:

48 observations of 2 variables: price and weight

Using the following linear regression equation:

fit <- lm(price ~ carat, data=diamond)

the relevant coefficients are:

(Intercept)       carat 
  -259.6259   3721.0249 

Slide 4

A Plot to show the linear relationship between the price and weight in carats

plot of chunk unnamed-chunk-2

Slide 5

Prediction equation:

As an example, if weight=0.2 carats, the predicted price will be:

price = coef(fit)[1] + coef(fit)[2]*0.2

price # In Singapore dollars
(Intercept) 
   484.5791 

The price of 0.2 carat diamond is estimated to be S$ 484.58