Linear Regression

65
Linear Regression William P. Wattles, Ph.D. Psychology 302

description

Linear Regression. William P. Wattles, Ph.D. Psychology 302. Correlation. - PowerPoint PPT Presentation

Transcript of Linear Regression

Page 1: Linear Regression

Linear Regression

William P. Wattles, Ph.D.Psychology 302

Page 2: Linear Regression

Correlation• Teen birth rate correlated

with our composite religiosity variable with r = 0.73; 95% CI (0.56,0.84); n = 49; p < 0.0005. Thus teen birth rate is very highly correlated with religiosity at the state level, with more religious states having a higher rate of teen birth. A scatter plot of teen birth rate as a function of religiosity is presented in Figure 1. http://www.reproductive-health-journal.com/content/6/1/14

Page 3: Linear Regression

• “Victor, when will you stop trying to remember and start trying to think?” --Helen Boyden

Page 4: Linear Regression

• You can use linear regression to answer the following questions about the pattern of data points and the significance of a linear equation:• 1. Is a pattern evident in a set of data

points?• 2. Does the equation of a straight line

describe this pattern?• 3. Are the predictions made from this

equation significant?

Page 5: Linear Regression

• Using Regression to predict college performance and college satisfaction.

Page 6: Linear Regression

Dependent and Independent Variables

• Dependent Variable-or Criterion Variable The variable whose variation we want to explain.

• Independent Variable-or Predictor Variable A variable that is related to or predicts variation in the dependent variable.

Page 7: Linear Regression

Examples• SAT score, college GPA• Alcohol consumed, score on a

driving test• type of car, Qualifying speed • level of education, Income• Number of boats registered,

deaths of manatees

Page 8: Linear Regression
Page 9: Linear Regression

Correlation• The relationship between two

variables X and Y.• In general, are changes in X

associated with Changes in Y?• If so we say that X and Y covary.• We can observe correlation by

looking at a scatter plot.

Page 10: Linear Regression

Correlation example• Is number of

beers consumed associated with blood alcohol level?

Page 11: Linear Regression

16

Beer consumption and Blood Alcohol Content

Page 12: Linear Regression
Page 13: Linear Regression

Correlation• Correlation coefficient tells us the

strength and direction of the relationship between two variables.

Page 14: Linear Regression

Prediction• If two variables

are related then knowing a value for one should allow us to predict the value of the other.

Page 15: Linear Regression

Regression• Allows us to

predict one variable based on the value of another.

Page 16: Linear Regression

Regression• Using knowledge of the

relationship between X and Y to predict Y given X.

• X the independent variable (predictor) used to explain changes in Y

• Y the dependent variable (criterion)

Page 17: Linear Regression

Linear regression• Regression line-a straight line

through the scatter plot that best describes the relationship.

• Regression line-predicts the value of Y for a given value of X.

Page 18: Linear Regression
Page 19: Linear Regression

Regression Line• A straight line that describes how a

dependent variable changes as the independent variable changes.

Page 20: Linear Regression

Least squares regression.• A method of determining the

regression line that minimizes the errors (residuals)

Page 21: Linear Regression
Page 22: Linear Regression

Least squares regression• residual is the error or the

amount that the observed observation deviates from the regression line.

• goal to find a solution that minimizes the squared residuals

• Least squares (the smallest possible sum of the squared residuals)

Page 23: Linear Regression

Least squares regression.• a is the intercept the value of y

when X=0• b is the slope the rate of change in

Y when X increases by 1

Page 24: Linear Regression

Regression formula• a=Ybar-bXbar• b=sum of deviation products/sum

of Xdev squared

Page 25: Linear Regression

Berk & Cary page 240Mortality vs. TemperatureBerk & Carey Page 303 y = 2.3577x - 21.795

R2 = 0.7654

50.0

60.0

70.0

80.0

90.0

100.0

110.0

30.0 35.0 40.0 45.0 50.0 55.0temperature

mor

talit

y in

dex

Page 26: Linear Regression

Simple Linear Regression

y a bx

Page 27: Linear Regression

The Regression Equation• x-the independent variable, the

predictor• y-the dependent variable, what we

want to predict• a-the intercept• b-the slope

Page 28: Linear Regression

Calculating the least-squares regression.

bx x y y

x x

( )( )

( ) 2

a y bx

Page 29: Linear Regression

Population

Page 30: Linear Regression

Population

Sample

β Beta Slopeα Alpha Intercept

b Slopea Intercept

Page 31: Linear Regression

• Crying and IQ page 600

Page 32: Linear Regression
Page 33: Linear Regression

Relationship• The scatterplot suggests a

relationship between crying and IQ.

• Can use knowledge of crying to predict IQ

Page 34: Linear Regression

• What would null say?

Page 35: Linear Regression

Null, says: “It’s nothing but sampling error.

HO

Page 36: Linear Regression

Ha• Babies who cry

easily may be more easily stimulated and have higher IQ’s

Page 37: Linear Regression

Steps to Analyze Regression Data

• Plot and interpret• Numerical

summary• Mathematical

model

Page 38: Linear Regression

Plot and Interpret• Plot independent

variable on the X axis

• Plot dependent variable on the Y axis.

• Examine form, direction and strength of relationship

Page 39: Linear Regression
Page 40: Linear Regression

Numerical Summary• Correlation coefficient tells

direction and strength of relationship.

r = +.455

Page 41: Linear Regression

r squared• r 2 percent of

variance in Y explained by X.

• =21%

Page 42: Linear Regression

Mathematical Model• Use model to predict IQ based on

knowledge of crying• Least Squares regression line.• Y predict=a + bx

• a(the intercept) =91.27• b the slope = 1.493

y

Page 43: Linear Regression

Excel Output

Page 44: Linear Regression

Sample Statistics• The slope and intercept are

statistics because they are calculated on the sample.

• We are really interested in estimating the population parameters

PopulationParameter

Sample Statistic

Page 45: Linear Regression

Residuals• Residuals-The difference between

the observed value of the dependent variable and and value predicted by the regression line.

residual y y

Page 46: Linear Regression

Coefficient of determination

• R2 the square of the correlation coefficient.

• The amount of the variation in Y that can be explained by changes in X

Page 47: Linear Regression

Regression and correlation• correlation tells us about the

relationship• regression allows us to predict Y if

we know X

Page 48: Linear Regression

Serotonin• 5-HT levels

predict mood in healthy males.

• SSRI, Zoloft, Prozac

Page 49: Linear Regression

Privitera page 531• Do levels of

serotonin predict positive mood in subjects?

Page 50: Linear Regression
Page 51: Linear Regression
Page 52: Linear Regression
Page 53: Linear Regression

Exam 2 as predictor

Page 54: Linear Regression

Exam 1 as predictor

Page 55: Linear Regression

Using the regression equation

• Exam 1 84% • exam1pred 80.8% • Exam 2 68% • exam2 pred 69.3%

Page 56: Linear Regression
Page 57: Linear Regression

Non-exercise activity and weight gain

• Does appraised value predict selling price?

• Page 622.

Page 58: Linear Regression

Francis Marion Univ.• http://vimeo.com/

39111127

Page 59: Linear Regression

Final Exam• 81 questions• All multiple choice

• chi square• independent t-

test• matched pairs• regression• single-sample t-

test

Page 60: Linear Regression

Time at table

• Does time at the lunch table predict how much young children eat?

• Page 629.

Page 61: Linear Regression

Arctic Rivers

• page 604• do data suggest a

change in discharge over time?

Page 62: Linear Regression

• Page 630 does pine cone count predict number of offspring in squirrels?

Page 63: Linear Regression

Low variability

Page 64: Linear Regression

High Variability

Page 65: Linear Regression

The End