R-helpdesk
Week 6: Lecture: Multivariate Linear models, interaction
and non-linearity
Multivariate Linear Regression Model
Multivariate linear regression= used to estimate the relationship between two or more
independent variables and one dependent variable
Residuals
➢ Residuals should be normal and equal (across the lines and between the groups)
➢ Residuals are added/subtracted from the one line they pertain to
➢ Difficult to observe in a plot --> Store the residuals as data and inspect them in
additional plots
Interaction/moderation effect
• Variables have different intercepts
• Variables have different slopes
Non-linearity in linear models
➢ Linear models allow to study non-linear relationships
➢ The effect changes with the independent variable
Two ways to solve non-linearity:
1. Adding a square in the equations (quadratic term)
2. Using a logarithmic transformation
Unit 550 – Multiple regression addition: the effect of two variables
Addition regression models= variables are independently having an impact on a
dependent variable
The effect of a dummy and a ratio variable on a scale(ratio) variable
Example: Effects of education and family type upbringing on emotional intelligence
, • 𝛽0 = intercept of both groups when family type is 0
• 𝛽0 + 𝛽2 = intercept when family type is 1
• Education (𝛽1) has the same effect in both groups = parallel lines
Linear equation:
When analyzing data, always check:
1. Independent cases condition
2. Random selection of cases
3. Normal distribution
a. Residuals should be normal and equal
4. (10% condition) = if the population is huge and you select more than 10% you can't
use inferential statistics
Hypothesis in multiple regression: two types of expectations
General expectation:
➢ R² and F-test
H0: 𝛽2 = 𝛽1 = 0 (variables have no effect)
H1: at least one 𝛽 is not 0
Specific expectation(s):
➢ b-coefficients and t-test
H0: 𝛽... = 0 (variable has no effect)
H1: 𝛽... ≠ 0 (variable has an effect)
,Conclusion:
• Education has the same effect on Emotional Intelligence
• Family type upbringing has an effect - explains differences in Emotional intelligence
The effect of two ratio variables on a scale(ratio) variable
Example: Determinants of Ageism
• When you get older, your prejudice against other elderly goes down
• With more education, prejudice decrease
• Intercept (𝛽0) = level of Ageism if BOTH Age AND Education are 0
o Differences in Education are shown by differences in the intercept
• Age (𝛽1) has the same effect over all groups= parallel lines
Linear equation: addition
Addition= we add the effect of two variables to understand the dependent variable
, • 𝛽0 + 𝛽2= intercept
• 𝛽1= effect
When analyzing data, always check:
• Residuals: not possible to check using simple visual inspection
• Direction: check if b's are positive or negative
Studying residuals in a multivariate context
Residuals in a multivariate context are explained by both independent variables
➢ Residuals are added/subtracted from the one line they pertain to
➢ Difficult to observe in a plot --> Store the residuals as data and inspect them in
additional plots
Residuals should be:
➢ Normal distribution
➢ Equal variance everywhere in the model (across the lines and between the groups)
Why is it important to check if residuals are 'problematic'?
• Maybe not linearity
• Maybe other factors play a role too
• Standard errors used for inference will be 'wrong'
Steps for checking residuals
1. Check 'overall' normality in a histogram
2. Checking residuals with all x variables and y variables in the dataset/model