SlideShare a Scribd company logo
1 of 23
Download to read offline
1
What is covered in this presentation and the topics that
precede it
• Descriptive (summary) statistics
• Binary linear regression
• Multiple (multivariate) regression
– Two (or more) scale independent variables
– Dummy variable as independent variable
– Interaction terms
2
Review
Ordinary Least Square (OLS) Linear Regression
• No measurement error
• All relevant Xs are included
• No irrelevant X is included
• E(ei) = 0
• Var(ei) = σ2 (constant)
• Cov(ei, Xi) = 0
• Variations in X
• k < n
When several conditions are met, OLS is B.L.U.E.
(Best, Linear, Unbiased Estimator).
30.00 5.00 10.00 15.00 20.00 25.00
Percent workers who are union members
30.0
40.0
50.0
60.0PercentvotingforKerry2004
Review
Linear Regression. Find the line that best fits the data
4
Y
constant
0 X
Y = α + β X
Y = αhat+ βhatXi + εi
..
.
. The OLS regression line
minimizes the sum of
squared errors. Error =
Review
Linear Regression
5
Review
Linear Regression
Hillary Clinton’s
vote share as a
function of %black.
Each dot
represents a state
in the United
States.
6
Review
Multiple regression with two scale/interval level
independent variables
X1
X2
Y
We can’t visualize
multiple regression
with more than two
independent variables
for obvious reason.
X1i
X2j
Yi
Y = α+ β1X1 +β2X2
α
7
Y
X
Two parallel lines with
different intercepts and common slope.
Review
Multiple regression with one interval level
independent variable and one dummy variable
8
Weekend
Weekday
-1.3 X
(temperature)
-29.7
28.3
Review
Multiple regression with dummy variable
Example (1)
Ice
cream
sales
Ice cream sales = α + βtemp*Temperature +
βweekend*Weekend
9
Review
Multiple Regression with dummy variable
Example (2)
Pay
($)
Experience
Pay = α + βexperience*Experience + βmale*Male
Male-female
difference
A sidenote
A nominal/categorical variable with more
than two value categories
10
NEW DUMMY VARIABLES
Frequency Percent
Valid
Percent
Cumulativ
e Percent white black other hispanic
-9 -9. Missing 33 .8 .8 .8
1 1. White, non-Hispanic
3038 71.1 71.1 71.9
1 0 0 0
2 2. Black, non-Hispanic
398 9.3 9.3 81.2
0 1 0 0
3 3. Asian, native Hawaiian
or other Pacif Islr,non-
Hispanic
148 3.5 3.5 84.7
0 0 1 0
4 4. Native American or
Alaska Native, non-Hispanic 27 .6 .6 85.3
0 0 1 0
5 5. Hispanic
450 10.5 10.5 95.9
0 0 0 1
6 6. Other non-Hispanic incl
multiple races [WEB: blank
'Other' counted as a race]
177 4.1 4.1 100.0
0 0 1 0
Total 4271 100.0 100.0
V161310x PRE: SUMMARY - R self-identified race
Valid
Can be transformed into a series of dummy
variables. These multiple dummy variables can be
used as independent variables.
11
Weekend
Weekday
-1.3 X
(temperature)
-29.7
28.3
Ice
cream
sales
Ice cream sales = α + βtemp*Temperature +
βweekend*Weekend
Ice cream sales cannot take
negative value…but
temperature in F virtually never
hits 0 in nature.
The ice cream example. Does this
represent actual data well? Maybe…….
12
Maybe not!
Interaction example (1)
Ice
cream
sales
Weekend
Weekday
Weekend
Weekday
Temperature
Temperature
Ice
cream
sales
13
Interaction example (2)
Pay
($)
Experience
Pay
($)
Experience
14
Interaction example (2) continued
Pay
($)
Experience
Pay
($)
Experience
Both the slopes
and the constants
can vary.
15
Interaction example (3) a. and b.
Bone
density
Cola Consumption
Alcohol
tolerance
Body weight
Male
Female
Male
Female
16
How Interaction Works (1) The simple model without
interaction
Pay = α + βexperience*Experience + βmale*Male
Pay
($)
Experience
α
βexperience
βmale
βexperience>0, βmale>0
The two groups, men and women, have different
intercepts and common slope
17
How Interaction Works (2) Adding an interaction
Pay = α + βexperience*Experience + βmale*Male +
βinteraction*Interaction
Pay
($)
Experience
α
βexperience
βmale
βinteraction
βexperience>0, βmale>0, βinteraction>0
The two groups, men and women, have different
intercepts and different slopes
18
How Interaction Works (3)
Pay = α + βmale+ (βexperience+ βinteraction)*Experience
Pay = α + βexperience*Experience
Pay
($)
Experience
α
βexperience
βmale
βinteraction
19
How Interaction Works (4)
Both cases (male, female) can be summarized by the
following single equation.
Pay = α + βexperience*Experience + βmale*Male +
βinteraction*Interaction
Interaction : Male*Experience
Pay
($)
Experience
α
βexperience
βmale
βinteraction
20
Employee# Salary Gender Experience Interaction (Male*Experience)
1 35.6 Male 14 14
2 16.4 Female 5 0
3 15.2 Male 3 3
4 24.7 Male 8 8
5 23.1 Female 9 0
(continued)
How Interaction Works (5) Example dataset
Creating an interaction
Interaction = Male*Experience
In SPSS, use Transform – Compute variables
In STATA, “gen male_exp=male*experience”
21
How Interaction Works (6) Estimation
Hypothetical results
Pay = 10 + 2*Experience + 1.5*Male + 0.2*Interaction
Pay = 10 + 1.5 + (2+0.2)*Experience
Pay = 10 + (2)*Experience
22
Summry
Multiple regression with Interaction
• Interaction term is a variable
• It allows slopes to diverge between Group 1 (1) and
Group 2 (0)
• It measures the difference in slope b/w Group 1 (1) and
Group 2 (0)
• It is created by multiplying dummy variable and the
interval level variable of interest
• When βinteraction > 0, the effect of X on Group 1 is greater
than its effect on Group 2. The slope will be steeper.
• When βinteraction < 0, the effect of X on Group 1 is smaller
than its effect on Group 2. The slope will be less steep.
23
Multiple Regression with Interaction
Steps in using interaction term
1. Choose a dependent variable (must be scale for OLS)
2. Create a dummy variable from one of the independent
variables. OR use R’s gender
3. Choose a scale variable for which an interaction may be
at work
4. Create an interaction by multiplying the two variables:
dummy and the scale
5. Estimate multiple regression with dummy, scale, and
the interaction b/w the two.

More Related Content

What's hot

Basic business statistics 2
Basic business statistics 2Basic business statistics 2
Basic business statistics 2Anwar Afridi
 
Reporting a single linear regression in apa
Reporting a single linear regression in apaReporting a single linear regression in apa
Reporting a single linear regression in apaKen Plummer
 
Reporting statistics in psychology
Reporting statistics in psychologyReporting statistics in psychology
Reporting statistics in psychologyReiner-Vinicius
 
Two-Way ANOVA Overview & SPSS interpretation
Two-Way ANOVA Overview & SPSS interpretationTwo-Way ANOVA Overview & SPSS interpretation
Two-Way ANOVA Overview & SPSS interpretationSr Edith Bogue
 
Non Linear Equation
Non Linear EquationNon Linear Equation
Non Linear EquationMdAlAmin187
 
Tutorial repeated measures ANOVA
Tutorial   repeated measures ANOVATutorial   repeated measures ANOVA
Tutorial repeated measures ANOVAKen Plummer
 
What is a two sample z test?
What is a two sample z test?What is a two sample z test?
What is a two sample z test?Ken Plummer
 
Reporting a Kruskal Wallis Test
Reporting a Kruskal Wallis TestReporting a Kruskal Wallis Test
Reporting a Kruskal Wallis TestKen Plummer
 
Null hypothesis for a Factorial ANOVA
Null hypothesis for a Factorial ANOVANull hypothesis for a Factorial ANOVA
Null hypothesis for a Factorial ANOVAKen Plummer
 
Chap03 numerical descriptive measures
Chap03 numerical descriptive measuresChap03 numerical descriptive measures
Chap03 numerical descriptive measuresUni Azza Aunillah
 
Bbs11 ppt ch12
Bbs11 ppt ch12Bbs11 ppt ch12
Bbs11 ppt ch12Tuul Tuul
 
Two-way Repeated Measures ANOVA
Two-way Repeated Measures ANOVATwo-way Repeated Measures ANOVA
Two-way Repeated Measures ANOVAJ P Verma
 
Probability And Probability Distributions
Probability And Probability Distributions Probability And Probability Distributions
Probability And Probability Distributions Sahil Nagpal
 
Inferential vs descriptive tutorial of when to use - Copyright Updated
Inferential vs descriptive tutorial of when to use - Copyright UpdatedInferential vs descriptive tutorial of when to use - Copyright Updated
Inferential vs descriptive tutorial of when to use - Copyright UpdatedKen Plummer
 
Confidence Intervals––Exact Intervals, Jackknife, and Bootstrap
Confidence Intervals––Exact Intervals, Jackknife, and BootstrapConfidence Intervals––Exact Intervals, Jackknife, and Bootstrap
Confidence Intervals––Exact Intervals, Jackknife, and BootstrapFrancesco Casalegno
 
Testing Assumptions in repeated Measures Design using SPSS
Testing Assumptions in repeated Measures Design using SPSSTesting Assumptions in repeated Measures Design using SPSS
Testing Assumptions in repeated Measures Design using SPSSJ P Verma
 
Reporting a multiple linear regression in APA
Reporting a multiple linear regression in APAReporting a multiple linear regression in APA
Reporting a multiple linear regression in APAAmit Sharma
 

What's hot (20)

Basic business statistics 2
Basic business statistics 2Basic business statistics 2
Basic business statistics 2
 
Reporting a single linear regression in apa
Reporting a single linear regression in apaReporting a single linear regression in apa
Reporting a single linear regression in apa
 
Reporting statistics in psychology
Reporting statistics in psychologyReporting statistics in psychology
Reporting statistics in psychology
 
Two-Way ANOVA Overview & SPSS interpretation
Two-Way ANOVA Overview & SPSS interpretationTwo-Way ANOVA Overview & SPSS interpretation
Two-Way ANOVA Overview & SPSS interpretation
 
Non Linear Equation
Non Linear EquationNon Linear Equation
Non Linear Equation
 
Tutorial repeated measures ANOVA
Tutorial   repeated measures ANOVATutorial   repeated measures ANOVA
Tutorial repeated measures ANOVA
 
What is a two sample z test?
What is a two sample z test?What is a two sample z test?
What is a two sample z test?
 
Reporting a Kruskal Wallis Test
Reporting a Kruskal Wallis TestReporting a Kruskal Wallis Test
Reporting a Kruskal Wallis Test
 
Null hypothesis for a Factorial ANOVA
Null hypothesis for a Factorial ANOVANull hypothesis for a Factorial ANOVA
Null hypothesis for a Factorial ANOVA
 
CH3.pdf
CH3.pdfCH3.pdf
CH3.pdf
 
Chap03 numerical descriptive measures
Chap03 numerical descriptive measuresChap03 numerical descriptive measures
Chap03 numerical descriptive measures
 
Simple Regression
Simple RegressionSimple Regression
Simple Regression
 
Bbs11 ppt ch12
Bbs11 ppt ch12Bbs11 ppt ch12
Bbs11 ppt ch12
 
Two-way Repeated Measures ANOVA
Two-way Repeated Measures ANOVATwo-way Repeated Measures ANOVA
Two-way Repeated Measures ANOVA
 
Ordinal Logistic Regression
Ordinal Logistic RegressionOrdinal Logistic Regression
Ordinal Logistic Regression
 
Probability And Probability Distributions
Probability And Probability Distributions Probability And Probability Distributions
Probability And Probability Distributions
 
Inferential vs descriptive tutorial of when to use - Copyright Updated
Inferential vs descriptive tutorial of when to use - Copyright UpdatedInferential vs descriptive tutorial of when to use - Copyright Updated
Inferential vs descriptive tutorial of when to use - Copyright Updated
 
Confidence Intervals––Exact Intervals, Jackknife, and Bootstrap
Confidence Intervals––Exact Intervals, Jackknife, and BootstrapConfidence Intervals––Exact Intervals, Jackknife, and Bootstrap
Confidence Intervals––Exact Intervals, Jackknife, and Bootstrap
 
Testing Assumptions in repeated Measures Design using SPSS
Testing Assumptions in repeated Measures Design using SPSSTesting Assumptions in repeated Measures Design using SPSS
Testing Assumptions in repeated Measures Design using SPSS
 
Reporting a multiple linear regression in APA
Reporting a multiple linear regression in APAReporting a multiple linear regression in APA
Reporting a multiple linear regression in APA
 

Similar to Multiple regression with interaction term 2018

Lecture 4 - Linear Regression, a lecture in subject module Statistical & Mach...
Lecture 4 - Linear Regression, a lecture in subject module Statistical & Mach...Lecture 4 - Linear Regression, a lecture in subject module Statistical & Mach...
Lecture 4 - Linear Regression, a lecture in subject module Statistical & Mach...Maninda Edirisooriya
 
Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92
Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92
Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92ohenebabismark508
 
Correlation and Regression in SPSS.ppt
Correlation and Regression in SPSS.pptCorrelation and Regression in SPSS.ppt
Correlation and Regression in SPSS.pptJamieLevitt1
 
Multiple Regression Model.pdf
Multiple Regression Model.pdfMultiple Regression Model.pdf
Multiple Regression Model.pdfUsamaIqbal83
 
Get Multiple Regression Assignment Help
Get Multiple Regression Assignment Help Get Multiple Regression Assignment Help
Get Multiple Regression Assignment Help HelpWithAssignment.com
 
슬로우캠퍼스: scikit-learn & 머신러닝 (강박사)
슬로우캠퍼스:  scikit-learn & 머신러닝 (강박사)슬로우캠퍼스:  scikit-learn & 머신러닝 (강박사)
슬로우캠퍼스: scikit-learn & 머신러닝 (강박사)마이캠퍼스
 
Regression vs Neural Net
Regression vs Neural NetRegression vs Neural Net
Regression vs Neural NetRatul Alahy
 
Multivariate Linear Regression.ppt
Multivariate Linear Regression.pptMultivariate Linear Regression.ppt
Multivariate Linear Regression.pptTanyaWadhwani4
 
Regression analysis
Regression analysisRegression analysis
Regression analysisSrikant001p
 
9_Poisson_printable.pdf
9_Poisson_printable.pdf9_Poisson_printable.pdf
9_Poisson_printable.pdfElio Laureano
 
Fuzzy logicintro by
Fuzzy logicintro by Fuzzy logicintro by
Fuzzy logicintro by Waseem Abbas
 
optimizedBell.pptx
optimizedBell.pptxoptimizedBell.pptx
optimizedBell.pptxRichard Gill
 
1. Consider the following partially completed computer printout fo.docx
1. Consider the following partially completed computer printout fo.docx1. Consider the following partially completed computer printout fo.docx
1. Consider the following partially completed computer printout fo.docxjackiewalcutt
 
Generalized linear model
Generalized linear modelGeneralized linear model
Generalized linear modelRahul Rockers
 
Regression on gaussian symbols
Regression on gaussian symbolsRegression on gaussian symbols
Regression on gaussian symbolsAxel de Romblay
 
whitehead-logistic-regression.ppt
whitehead-logistic-regression.pptwhitehead-logistic-regression.ppt
whitehead-logistic-regression.ppt19DSMA012HarshSingh
 
Logistic Regression.ppt
Logistic Regression.pptLogistic Regression.ppt
Logistic Regression.ppthabtamu biazin
 

Similar to Multiple regression with interaction term 2018 (20)

Lecture 4 - Linear Regression, a lecture in subject module Statistical & Mach...
Lecture 4 - Linear Regression, a lecture in subject module Statistical & Mach...Lecture 4 - Linear Regression, a lecture in subject module Statistical & Mach...
Lecture 4 - Linear Regression, a lecture in subject module Statistical & Mach...
 
Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92
Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92
Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92
 
Correlation and Regression in SPSS.ppt
Correlation and Regression in SPSS.pptCorrelation and Regression in SPSS.ppt
Correlation and Regression in SPSS.ppt
 
Multiple Regression Model.pdf
Multiple Regression Model.pdfMultiple Regression Model.pdf
Multiple Regression Model.pdf
 
Get Multiple Regression Assignment Help
Get Multiple Regression Assignment Help Get Multiple Regression Assignment Help
Get Multiple Regression Assignment Help
 
슬로우캠퍼스: scikit-learn & 머신러닝 (강박사)
슬로우캠퍼스:  scikit-learn & 머신러닝 (강박사)슬로우캠퍼스:  scikit-learn & 머신러닝 (강박사)
슬로우캠퍼스: scikit-learn & 머신러닝 (강박사)
 
Regression vs Neural Net
Regression vs Neural NetRegression vs Neural Net
Regression vs Neural Net
 
Multivariate Linear Regression.ppt
Multivariate Linear Regression.pptMultivariate Linear Regression.ppt
Multivariate Linear Regression.ppt
 
Regression analysis
Regression analysisRegression analysis
Regression analysis
 
Statistics for entrepreneurs
Statistics for entrepreneurs Statistics for entrepreneurs
Statistics for entrepreneurs
 
9_Poisson_printable.pdf
9_Poisson_printable.pdf9_Poisson_printable.pdf
9_Poisson_printable.pdf
 
Fuzzy logicintro by
Fuzzy logicintro by Fuzzy logicintro by
Fuzzy logicintro by
 
optimizedBell.pptx
optimizedBell.pptxoptimizedBell.pptx
optimizedBell.pptx
 
1. Consider the following partially completed computer printout fo.docx
1. Consider the following partially completed computer printout fo.docx1. Consider the following partially completed computer printout fo.docx
1. Consider the following partially completed computer printout fo.docx
 
Powerpoint2.reg
Powerpoint2.regPowerpoint2.reg
Powerpoint2.reg
 
01_SLR_final (1).pptx
01_SLR_final (1).pptx01_SLR_final (1).pptx
01_SLR_final (1).pptx
 
Generalized linear model
Generalized linear modelGeneralized linear model
Generalized linear model
 
Regression on gaussian symbols
Regression on gaussian symbolsRegression on gaussian symbols
Regression on gaussian symbols
 
whitehead-logistic-regression.ppt
whitehead-logistic-regression.pptwhitehead-logistic-regression.ppt
whitehead-logistic-regression.ppt
 
Logistic Regression.ppt
Logistic Regression.pptLogistic Regression.ppt
Logistic Regression.ppt
 

More from Keiko Ono

3-D geospatial data for disaster management and development
3-D geospatial data for disaster management and development3-D geospatial data for disaster management and development
3-D geospatial data for disaster management and developmentKeiko Ono
 
Political science meets computer science
Political science meets computer sciencePolitical science meets computer science
Political science meets computer scienceKeiko Ono
 
人口知能・自然言語処理・社会科学・政治学
人口知能・自然言語処理・社会科学・政治学人口知能・自然言語処理・社会科学・政治学
人口知能・自然言語処理・社会科学・政治学Keiko Ono
 
Data science week_1
Data science week_1Data science week_1
Data science week_1Keiko Ono
 
Data science week_2_visualization
Data science week_2_visualizationData science week_2_visualization
Data science week_2_visualizationKeiko Ono
 
US presidential selection: the Electoral College challenged (again)
US presidential selection: the Electoral College challenged (again)US presidential selection: the Electoral College challenged (again)
US presidential selection: the Electoral College challenged (again)Keiko Ono
 
The latest trends in academic research on GIS
The latest trends in academic research on GISThe latest trends in academic research on GIS
The latest trends in academic research on GISKeiko Ono
 
サーベイに基づく公的データが問題になった2例(2018年)
サーベイに基づく公的データが問題になった2例(2018年)サーベイに基づく公的データが問題になった2例(2018年)
サーベイに基づく公的データが問題になった2例(2018年)Keiko Ono
 
比べてみた関関同立の研究力 Top Kansai private universities' research output
比べてみた関関同立の研究力 Top Kansai private universities' research output 比べてみた関関同立の研究力 Top Kansai private universities' research output
比べてみた関関同立の研究力 Top Kansai private universities' research output Keiko Ono
 
Research analysis waseda_2018
Research analysis waseda_2018Research analysis waseda_2018
Research analysis waseda_2018Keiko Ono
 
Journal analysis SSJJ 2018
Journal analysis SSJJ 2018Journal analysis SSJJ 2018
Journal analysis SSJJ 2018Keiko Ono
 
Journal analysis JJPS_2017
Journal analysis JJPS_2017Journal analysis JJPS_2017
Journal analysis JJPS_2017Keiko Ono
 
How academic research on GitHub has evolved in the last several years
How academic research on GitHub has evolved in the last several yearsHow academic research on GitHub has evolved in the last several years
How academic research on GitHub has evolved in the last several yearsKeiko Ono
 
Multiple regression: creating a dummy variable and an interaction
Multiple regression: creating a dummy variable and an interaction Multiple regression: creating a dummy variable and an interaction
Multiple regression: creating a dummy variable and an interaction Keiko Ono
 
The Russians, the US presidency in peril, and the Mueller investigation
The Russians, the US presidency in peril, and the Mueller investigationThe Russians, the US presidency in peril, and the Mueller investigation
The Russians, the US presidency in peril, and the Mueller investigationKeiko Ono
 
Data visualization and its application to politics and elections
Data visualization and its application to politics and electionsData visualization and its application to politics and elections
Data visualization and its application to politics and electionsKeiko Ono
 
Open meteorological data_himeji
Open meteorological data_himejiOpen meteorological data_himeji
Open meteorological data_himejiKeiko Ono
 
Encoding in excel
Encoding in excelEncoding in excel
Encoding in excelKeiko Ono
 
Data tools transform_multiple_dummy
Data tools transform_multiple_dummyData tools transform_multiple_dummy
Data tools transform_multiple_dummyKeiko Ono
 

More from Keiko Ono (20)

3-D geospatial data for disaster management and development
3-D geospatial data for disaster management and development3-D geospatial data for disaster management and development
3-D geospatial data for disaster management and development
 
Political science meets computer science
Political science meets computer sciencePolitical science meets computer science
Political science meets computer science
 
人口知能・自然言語処理・社会科学・政治学
人口知能・自然言語処理・社会科学・政治学人口知能・自然言語処理・社会科学・政治学
人口知能・自然言語処理・社会科学・政治学
 
Data science week_1
Data science week_1Data science week_1
Data science week_1
 
Data science week_2_visualization
Data science week_2_visualizationData science week_2_visualization
Data science week_2_visualization
 
US presidential selection: the Electoral College challenged (again)
US presidential selection: the Electoral College challenged (again)US presidential selection: the Electoral College challenged (again)
US presidential selection: the Electoral College challenged (again)
 
The latest trends in academic research on GIS
The latest trends in academic research on GISThe latest trends in academic research on GIS
The latest trends in academic research on GIS
 
サーベイに基づく公的データが問題になった2例(2018年)
サーベイに基づく公的データが問題になった2例(2018年)サーベイに基づく公的データが問題になった2例(2018年)
サーベイに基づく公的データが問題になった2例(2018年)
 
比べてみた関関同立の研究力 Top Kansai private universities' research output
比べてみた関関同立の研究力 Top Kansai private universities' research output 比べてみた関関同立の研究力 Top Kansai private universities' research output
比べてみた関関同立の研究力 Top Kansai private universities' research output
 
Research analysis waseda_2018
Research analysis waseda_2018Research analysis waseda_2018
Research analysis waseda_2018
 
Journal analysis SSJJ 2018
Journal analysis SSJJ 2018Journal analysis SSJJ 2018
Journal analysis SSJJ 2018
 
Journal analysis JJPS_2017
Journal analysis JJPS_2017Journal analysis JJPS_2017
Journal analysis JJPS_2017
 
How academic research on GitHub has evolved in the last several years
How academic research on GitHub has evolved in the last several yearsHow academic research on GitHub has evolved in the last several years
How academic research on GitHub has evolved in the last several years
 
Multiple regression: creating a dummy variable and an interaction
Multiple regression: creating a dummy variable and an interaction Multiple regression: creating a dummy variable and an interaction
Multiple regression: creating a dummy variable and an interaction
 
The Russians, the US presidency in peril, and the Mueller investigation
The Russians, the US presidency in peril, and the Mueller investigationThe Russians, the US presidency in peril, and the Mueller investigation
The Russians, the US presidency in peril, and the Mueller investigation
 
Data visualization and its application to politics and elections
Data visualization and its application to politics and electionsData visualization and its application to politics and elections
Data visualization and its application to politics and elections
 
Saitama
SaitamaSaitama
Saitama
 
Open meteorological data_himeji
Open meteorological data_himejiOpen meteorological data_himeji
Open meteorological data_himeji
 
Encoding in excel
Encoding in excelEncoding in excel
Encoding in excel
 
Data tools transform_multiple_dummy
Data tools transform_multiple_dummyData tools transform_multiple_dummy
Data tools transform_multiple_dummy
 

Recently uploaded

04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts ServiceSapana Sha
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一ffjhghh
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad EscortsCall girls in Ahmedabad High profile
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxEmmanuel Dauda
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 

Recently uploaded (20)

04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts Service
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
(ISHITA) Call Girls Service Hyderabad Call Now 8617697112 Hyderabad Escorts
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptx
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 

Multiple regression with interaction term 2018

  • 1. 1 What is covered in this presentation and the topics that precede it • Descriptive (summary) statistics • Binary linear regression • Multiple (multivariate) regression – Two (or more) scale independent variables – Dummy variable as independent variable – Interaction terms
  • 2. 2 Review Ordinary Least Square (OLS) Linear Regression • No measurement error • All relevant Xs are included • No irrelevant X is included • E(ei) = 0 • Var(ei) = σ2 (constant) • Cov(ei, Xi) = 0 • Variations in X • k < n When several conditions are met, OLS is B.L.U.E. (Best, Linear, Unbiased Estimator).
  • 3. 30.00 5.00 10.00 15.00 20.00 25.00 Percent workers who are union members 30.0 40.0 50.0 60.0PercentvotingforKerry2004 Review Linear Regression. Find the line that best fits the data
  • 4. 4 Y constant 0 X Y = α + β X Y = αhat+ βhatXi + εi .. . . The OLS regression line minimizes the sum of squared errors. Error = Review Linear Regression
  • 5. 5 Review Linear Regression Hillary Clinton’s vote share as a function of %black. Each dot represents a state in the United States.
  • 6. 6 Review Multiple regression with two scale/interval level independent variables X1 X2 Y We can’t visualize multiple regression with more than two independent variables for obvious reason. X1i X2j Yi Y = α+ β1X1 +β2X2 α
  • 7. 7 Y X Two parallel lines with different intercepts and common slope. Review Multiple regression with one interval level independent variable and one dummy variable
  • 8. 8 Weekend Weekday -1.3 X (temperature) -29.7 28.3 Review Multiple regression with dummy variable Example (1) Ice cream sales Ice cream sales = α + βtemp*Temperature + βweekend*Weekend
  • 9. 9 Review Multiple Regression with dummy variable Example (2) Pay ($) Experience Pay = α + βexperience*Experience + βmale*Male Male-female difference
  • 10. A sidenote A nominal/categorical variable with more than two value categories 10 NEW DUMMY VARIABLES Frequency Percent Valid Percent Cumulativ e Percent white black other hispanic -9 -9. Missing 33 .8 .8 .8 1 1. White, non-Hispanic 3038 71.1 71.1 71.9 1 0 0 0 2 2. Black, non-Hispanic 398 9.3 9.3 81.2 0 1 0 0 3 3. Asian, native Hawaiian or other Pacif Islr,non- Hispanic 148 3.5 3.5 84.7 0 0 1 0 4 4. Native American or Alaska Native, non-Hispanic 27 .6 .6 85.3 0 0 1 0 5 5. Hispanic 450 10.5 10.5 95.9 0 0 0 1 6 6. Other non-Hispanic incl multiple races [WEB: blank 'Other' counted as a race] 177 4.1 4.1 100.0 0 0 1 0 Total 4271 100.0 100.0 V161310x PRE: SUMMARY - R self-identified race Valid Can be transformed into a series of dummy variables. These multiple dummy variables can be used as independent variables.
  • 11. 11 Weekend Weekday -1.3 X (temperature) -29.7 28.3 Ice cream sales Ice cream sales = α + βtemp*Temperature + βweekend*Weekend Ice cream sales cannot take negative value…but temperature in F virtually never hits 0 in nature. The ice cream example. Does this represent actual data well? Maybe…….
  • 12. 12 Maybe not! Interaction example (1) Ice cream sales Weekend Weekday Weekend Weekday Temperature Temperature Ice cream sales
  • 14. 14 Interaction example (2) continued Pay ($) Experience Pay ($) Experience Both the slopes and the constants can vary.
  • 15. 15 Interaction example (3) a. and b. Bone density Cola Consumption Alcohol tolerance Body weight Male Female Male Female
  • 16. 16 How Interaction Works (1) The simple model without interaction Pay = α + βexperience*Experience + βmale*Male Pay ($) Experience α βexperience βmale βexperience>0, βmale>0 The two groups, men and women, have different intercepts and common slope
  • 17. 17 How Interaction Works (2) Adding an interaction Pay = α + βexperience*Experience + βmale*Male + βinteraction*Interaction Pay ($) Experience α βexperience βmale βinteraction βexperience>0, βmale>0, βinteraction>0 The two groups, men and women, have different intercepts and different slopes
  • 18. 18 How Interaction Works (3) Pay = α + βmale+ (βexperience+ βinteraction)*Experience Pay = α + βexperience*Experience Pay ($) Experience α βexperience βmale βinteraction
  • 19. 19 How Interaction Works (4) Both cases (male, female) can be summarized by the following single equation. Pay = α + βexperience*Experience + βmale*Male + βinteraction*Interaction Interaction : Male*Experience Pay ($) Experience α βexperience βmale βinteraction
  • 20. 20 Employee# Salary Gender Experience Interaction (Male*Experience) 1 35.6 Male 14 14 2 16.4 Female 5 0 3 15.2 Male 3 3 4 24.7 Male 8 8 5 23.1 Female 9 0 (continued) How Interaction Works (5) Example dataset Creating an interaction Interaction = Male*Experience In SPSS, use Transform – Compute variables In STATA, “gen male_exp=male*experience”
  • 21. 21 How Interaction Works (6) Estimation Hypothetical results Pay = 10 + 2*Experience + 1.5*Male + 0.2*Interaction Pay = 10 + 1.5 + (2+0.2)*Experience Pay = 10 + (2)*Experience
  • 22. 22 Summry Multiple regression with Interaction • Interaction term is a variable • It allows slopes to diverge between Group 1 (1) and Group 2 (0) • It measures the difference in slope b/w Group 1 (1) and Group 2 (0) • It is created by multiplying dummy variable and the interval level variable of interest • When βinteraction > 0, the effect of X on Group 1 is greater than its effect on Group 2. The slope will be steeper. • When βinteraction < 0, the effect of X on Group 1 is smaller than its effect on Group 2. The slope will be less steep.
  • 23. 23 Multiple Regression with Interaction Steps in using interaction term 1. Choose a dependent variable (must be scale for OLS) 2. Create a dummy variable from one of the independent variables. OR use R’s gender 3. Choose a scale variable for which an interaction may be at work 4. Create an interaction by multiplying the two variables: dummy and the scale 5. Estimate multiple regression with dummy, scale, and the interaction b/w the two.