1/25
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Testing Assumptions
checks whether data meet the conditions required for a statistical or regression method. Common assumptions include normality, independence, homoscedasticity, linearity, and absence of severe multicollinearity.
Independence
observations/residuals are not systematically dependent on one another
Homoscedasticity
· residuals have approximately constant variance.
Linearity
· the relationship between predictors and the outcome is approximately linear.
No severe multicollinearity
· independent variables are not excessively correlated with each other.
Fail to reject H
p-value > 0.05
Reject H
p-value ≤ 0.05
Normality
shapiro.test(residuals(model))
Hypotheses:
· H₀: Residuals are normally distributed.
· H₁: Residuals are not normally distributed.
Interpretation:
· p > 0.05 → no significant evidence of non-normality.
· p ≤ 0.05 → evidence of non-normality.
Visual checks:
qqnorm(residuals(model))
qqline(residuals(model))
hist(residuals(model))
Linearity
plot(x,y)
plot(model)
Homoscedasticity
library(lmtest)
bptest(model)
Hypotheses
H₀: The variance is constant (homoscedasticity).
H₁: The variance is not constant (heteroscedasticity).
Decision rule
At α = 0.05:
p > 0.05
→ Fail to reject H₀
→ No significant evidence of heteroscedasticity.
p < 0.05
→ Reject H₀
→ Evidence of heteroscedasticity.
If the residuals form a funnel:
.
. .
. .
.
.
the variance is changing → possible heteroscedasticity.
Independence/autocorrelation
library(lmtest)
dwtest(model)
Durbin-Watson test:
· H₀: No autocorrelation.
· H₁: Autocorrelation exists.
· p > 0.05 → no significant evidence of autocorrelation.
· p ≤ 0.05 → evidence of autocorrelation.
Multicollinearity
install.packages('car')
library(car)
vif(model)
Common rules of thumb:
· VIF ≈ 1 → little multicollinearity.
· VIF 1–5 → often considered acceptable.
· VIF > 5 → possible concern.
· VIF > 10 → commonly treated as serious concern.
Residuals
= Actual value − Predicted value
residuals(model)
model$residuals
Basic regression
Simple:
lm(Y ~ X, data = data)
Multiple:
lm(Y ~ X1 + X2 + X3, data = data)
4 main diagnostic plots
Residuals vs fitted
Normal-qq
Scale-location
Residuals vs leverage
Residuals vs fitted
mainly checks linearity and constant variance.
Normal-qq
checks whether residuals approximately follow a normal distribution
Scale-location
helps assess whether residual spread is roughly constant.
Residuals vs leverage
· helps identify observations that may be influential.
Log Transformation
converts a positive variable into its logarithm, commonly the natural logarithm (ln). It is often used with skewed economic data, large ranges, nonlinear relationships, or changing variance.
log(dataincome)</span></p><p><span>datalog_income <- log(data$income)
· Reduce right skewness.
· Compress very large values and reduce the influence of extreme scale differences.
· Sometimes improve linearity.
· Sometimes reduce heteroscedasticity.
· Allow useful percentage and elasticity interpretations in economic models.
Level - Level
Y ~ X | 1-unit increase in X → β-unit change in Y |
Log level
log(Y) ~ X | 1-unit increase in X → approximately 100β% change in Y |
Level log
Y ~ log(X) | 1% increase in X → approximately β/100-unit change in Y |
Log log
log(Y) ~ log(X) | 1% increase in X → approximately β% change in Y |
Log log model
model_log <- lm(log(x) ~ log(y), data = data)
In a log-log model, the slope coefficient is interpreted as an elasticity.
Log transformation and assumption testing
If an original model shows a possible problem such as heteroscedasticity, a researcher may consider a theoretically appropriate transformation and then re-check the model.
model_log <- lm(log(x) ~ log(y), data = data)
bptest(model_log)
shapiro.test(residuals(model_log))
plot(model_log)