
Statistical Methods with R
Unit D · Chapter 10 · Lecture 10b
Developed by Jeffrey M. Girard
Consequences of Violating
Bias in standard errors only


check_heteroscedasticity(fit)
check_model(fit, check = "homogeneity")
Consequences of Violating
Standard errors will be biased
Note that addressing other issues may also help here.
Consequences of Violating
Standard errors will be downwardly biased (i.e., deflated)
check_autocorrelation(fit)

\[b_0=3.4, b_1=2.2^\ast\]

\[b_0=15.5^\ast, b_1= 0.3\]
For each observation, we can calculate its…
check_outliers(fit_with, method = c("cook", "mahalanobis"))
## 1 outlier detected: case 2.
## - Based on the following methods and thresholds: cook (0.701),
## mahalanobis (13.816).
## - For variable: (Whole model).
##
## Note: Outliers were classified as such by at least half of the selected methods.
##
## -----------------------------------------------------------------------------
##
## The following observations were considered outliers for two or more
## variables by at least one of the selected methods:
##
## Row n_Mahalanobis n_Cook
## 1 2 (Multivariate) (Multivariate)If you do choose to remove the outliers, here’s how
# Number of observations before removing outliers
nrow(dat_with)
## [1] 62
# Identify outliers
outliers <- check_outliers(fit_with, method = c("cook", "mahalanobis"))
# Remove outliers
dat_drop <- dat_with[!as.numeric(outliers), ]
# Number of observations after removing outliers
nrow(dat_drop)
## [1] 61