R E G R E S S I O N A N D I N F E R E N C E PMAP 8521: Program Evaluation for Public Service September 9, 2019 Fill out your reading report on iCollege!
P L A N F O R T O D A Y Revisiting R Markdown Correlation, regression, and drawing lines Lines, math, and Greek Multiple regression Regression and inference
R E V I S I T I N G R M A R K D O W N
C O R R E L AT I O N , R E G R E S S I O N , & D R A W I N G L I N E S
<latexit sha1_base64="3UWqH+h+phJvoyM38Yj4hYdKMFw=">ADCnichVFdaxNBFJ1dv2r8Su2jCoOpkIKG3VBQHwpFX3ysYNpCNlmJ5N2yHxsZu7WLM8+Kv8U189U/4I/wPzqZBTSp4YeHMuefes9xTlIJbSJIfUXzt+o2bt7Zut+7cvXf/QXv74bHVlaFsQLXQ5rQglgmu2A4CHZaGkZkIdhJMXvb9E8umLFcqw9Ql2wkyZniU04JBCpvfzK5W9QeH+Bsagh1ma1k7nh4p36scHeRc/wCZwUxbuH3uvWfZ+3fJDPDfxnaNzHm4L1NeO+93m7k/SZeGrIF2BDlrVUb4dzbKJpVkCqg1g7TpISRIwY4Fcy3sqyktAZOWPDABWRzI7c8mIePwvMBE+1CZ8CvGT/nBEWlvLIiglgXO72WvIf/WGFUxfjRxXZQVM0UujaSUwaNycH0+4YREHQChod/xfSchMtDCKm1ZtMsB62F9YFX7CPVUhI1cVnIE9g8HN9oIMAKvXCvE+92s+cHu96va9m8IgK0H/ZHLqvUJLiwJrDgXYKFWrBMX6xIOWNG7cvqt0EnBOM6adgZ4k3w7gKjvu9NOml7/c7h29WQW2hR+gp6qIUvUSH6B06QgNE0c9oJ3ocPYk/x1/ir/G3S2kcrWZ20FrF38BRdP3vQ=</latexit> <latexit sha1_base64="3UWqH+h+phJvoyM38Yj4hYdKMFw=">ADCnichVFdaxNBFJ1dv2r8Su2jCoOpkIKG3VBQHwpFX3ysYNpCNlmJ5N2yHxsZu7WLM8+Kv8U189U/4I/wPzqZBTSp4YeHMuefes9xTlIJbSJIfUXzt+o2bt7Zut+7cvXf/QXv74bHVlaFsQLXQ5rQglgm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4k3w7gKjvu9NOml7/c7h29WQW2hR+gp6qIUvUSH6B06QgNE0c9oJ3ocPYk/x1/ir/G3S2kcrWZ20FrF38BRdP3vQ=</latexit> <latexit sha1_base64="3UWqH+h+phJvoyM38Yj4hYdKMFw=">ADCnichVFdaxNBFJ1dv2r8Su2jCoOpkIKG3VBQHwpFX3ysYNpCNlmJ5N2yHxsZu7WLM8+Kv8U189U/4I/wPzqZBTSp4YeHMuefes9xTlIJbSJIfUXzt+o2bt7Zut+7cvXf/QXv74bHVlaFsQLXQ5rQglgmu2A4CHZaGkZkIdhJMXvb9E8umLFcqw9Ql2wkyZniU04JBCpvfzK5W9QeH+Bsagh1ma1k7nh4p36scHeRc/wCZwUxbuH3uvWfZ+3fJDPDfxnaNzHm4L1NeO+93m7k/SZeGrIF2BDlrVUb4dzbKJpVkCqg1g7TpISRIwY4Fcy3sqyktAZOWPDABWRzI7c8mIePwvMBE+1CZ8CvGT/nBEWlvLIiglgXO72WvIf/WGFUxfjRxXZQVM0UujaSUwaNycH0+4YREHQChod/xfSchMtDCKm1ZtMsB62F9YFX7CPVUhI1cVnIE9g8HN9oIMAKvXCvE+92s+cHu96va9m8IgK0H/ZHLqvUJLiwJrDgXYKFWrBMX6xIOWNG7cvqt0EnBOM6adgZ4k3w7gKjvu9NOml7/c7h29WQW2hR+gp6qIUvUSH6B06QgNE0c9oJ3ocPYk/x1/ir/G3S2kcrWZ20FrF38BRdP3vQ=</latexit> C O R R E L A T I O N P n i =1 ( x i − ¯ x )( y i − ¯ y ) r xy = pP n x ) 2 P n i =1 ( x i − ¯ i =1 ( y i − ¯ y ) 2 How closely two variables are related + direction of relation −1 to 1 −1 and 1 = perfectly correlated; 0 = perfectly uncorrelated
r = 0.849 r = 0.863
r = − 0.868
r = 0.021 r = 0.001
G E N E R A L G U I D E L I N E S 0 Can be positive No relationship or negative 0.01–0.19 Little to no relationship 0.20–0.29 Weak relationship 0.30–0.39 Moderate relationship 0.40–0.69 Strong relationship 0.70–0.99 Very strong relationship 1 Perfect relationship
T E M P L A T E As the value of X goes up, Y tends to go up (or down) a lot/a little/not at all
W H Y R E G R E S S I O N ? Correlation between car weight and mileage (MPG) is −0.868 If you shave 1 ton off the weight of a car, how much will the car’s mileage improve? Correlation shows direction and magnitude. That’s all.
E S S E N T I A L P A R T S ~ Y X (or lots of Xs) Outcome variable Explanatory variable Response variable Predictor variable Dependent variable Independent variable Thing you want to Thing you use to explain or predict explain changes in Y
I D E N T I F Y V A R I A B L E S A study examines the effect of You want to see if students taking smoking on lung cancer more AP classes in high school improves their college grades Researchers predict genocides by looking at negative media Netflix uses your past viewing coverage, revolutions in history, the day of the week, and neighboring countries, and the time of the day to guess which economic growth show you want to watch next
T W O P U R P O S E S O F R E G R E S S I O N Prediction Explanation Forecast the future Explain effect of X on Y Focus is on Y Focus is on X Netflix trying to Netflix looking at the effect of guess your next show time of day on show selection Predicting who will Looking at the effect of food escape poverty stamps on poverty reduction
H O W Plot X and Y Draw a line that approximates the relationship Find mathy parts of the line Interpret the math
C O O K I E C O N S U M P T I O N A N D H A P P I N E S S
r = 0.607
Ordinary least squares (OLS) regression
L I N E S , M AT H , A N D G R E E K
D R A W I N G L I N E S W I T H M A T H 𝒛 = 𝒏𝒚 + 𝒄 y A number x A number 𝑠𝑗𝑡𝑓 m Slope 𝑠𝑣𝑜 b y intercept
S L O P E S A N D I N T E R C E P T S 𝒛 = 𝟑𝒚 − 𝟐 𝒛 = −𝟏. 𝟔𝒚 + 𝟕
G R A P H T H E S E 𝒛 = 𝟔𝒚 + 𝟑 𝒛 = 𝒚 − 𝟐 𝒛 = −𝟑𝒚 + 𝟐𝟐 𝒛 = 𝟕 − 𝟑𝒚 𝒛 = 𝟏. 𝟒𝟒𝒚 − 𝟐 𝒛 = 𝟏. 𝟖𝟔𝒚 − 𝟒
D R A W I N G L I N E S W I T H S T A T S 6 𝒛 = 𝜸 𝟏 + 𝜸 𝟐 𝒚 𝟐 + 𝜻 𝒛 = 𝒏𝒚 + 𝒄 6 y 𝒛 Outcome variable 𝒚 𝟐 x Explanatory variable 𝜸 𝟐 m Slope b 𝜸 𝟏 ( α ) y-intercept 𝜻 Error (residuals)
Recommend
More recommend