Types of variables • • • •
Nominal Ordinal Interval Ratio
DataCamp ! !
Learning by doing
Simple vs. multiple regression • Simple regression – Just one predictor (X)
• Multiple regression – Multiple predictors (X1, X2, X3, …)
Multiple regression • Multiple regression equation – Just add more predictors (multiple Xs) Ŷ = B0 + B1X1 + B2X2 + B3X3 + … + BkXk
Ŷ= B0 + Σ(BkXk)
Multiple regression • Multiple regression equation Ŷ = predicted value on the outcome variable Y B0 = predicted value on Y when all X = 0 Xk = predictor variables Bk = unstandardized regression coefficients Y - Ŷ = residual (prediction error) k = the number of predictor variables
Model R and
2 R
• R = multiple correlation coefficient
•
– R = rÝY – The correlation between the predicted scores and the observed scores
2 R
– The percentage of variance in Y explained by the model
Multiple regression: Example • Outcome measure (Y) – Faculty salary (Y)
• Predictors (X1, X2, X3) – Time since PhD (X1) – Number of publications (X2) – Gender (X3)
Summary statistics M Salary
SD $64,115
$17,110
Time
8.09
5.24
Publications
15.49
7.51
Multiple regression: Example • Gender – Male = 0 – Female = 1
Multiple regression: Example • lm(Salary ~ Time + Pubs + Gender) • Ŷ = 46,911 + 1,382(Time) + 502(Pubs) + -3,484(Gender)
Table of coefficients B
SE
t
β
p
B0
46,911
Time
1,382
236
5.86
.42
< .01
Pubs
502
164
3.05
.22
< .01
-3,484
2,439
-1.43
-.10
.16
Gender
Ŷ = 46,911 + 1,382(Time) + 502(Pubs) + -3,484(Gender)
Multiple regression: Example • • • •
What is $46,911? What is $502? Who makes more money, men or women? According to this model, is the gender difference statistically significant? • What is the strongest predictor of salary?
Multiple regression: Example • $46,911 is the predicted salary for a male professor who just graduated and has no publications (predicted score when all X=0) • $502 is the predicted change in salary associated with an increase of one publication, for professors who have been out of school for an average amount of time, averaged across men and women
Multiple regression: Example • Who makes more money, men or women?
– Trick question: Based on the output we can’t answer this question
• According to this model, is the gender difference statistically significant? – No
Multiple regression: Example • What is the strongest predictor of salary? – Time