The second lab assignment is due by 2 PM on Sunday, January 26, 2020. You will respond to questions in this script. You will write corresponding R code in a code chunk for each question. Make sure to clearly annotate all of your code. You will submit this completed R Markdown script and a PDF rendered version of it to D2L by the due date and time.
Start by creating a folder for this lab assignment. You should treat each lab and exam assignment as an R Project. First, create a folder named Lab_3 on your computer to save all relevant files for this lab assignment. Go to the File menu in RStudio, select New Project…, choose Existing Directory, go to your Lab_3 folder to select it as the top-level directory for this R Project.
You should create three additional sub-folders named Scripts, Data, and Plots. You should store this script in the Scripts folder, the data for this lab assignment in the Data folder, and any requested plots in the Plots folder.
We load the libraries we need for this script. If your computer did not already install these packages, then you need to install them first. To install packages, you can either:
### Load libaries for use in current working session
## Library "here" for workflow
library(here)
## tidyverse for data manipulation and plotting
# Loads eight different libraries simultaneously
library(tidyverse)
## broom to extract output cleanly from many statistical models including "lm"
library(broom)
## knitr to produce pleasing tables
library(knitr)
## olsrr for regression diagnostics
library(olsrr)
library(reshape2)
library(plotly)
library(ggpubr)
We load the facebook_likes.RData and the students.RData from the Data project directory folder.
## Load data via the here function
load(here("Data", "students.RData"))
Working from students, create a new data frame named, sel_stud, consisting of only the complete cases for the variables proc, consc, neuro, extra, intell, and agree. Answer and execute the following:
(a). Estimate the additive unstandardized multiple regression model where the Big 5 of personality predict procrastination (proc). Name the model: mod. Print the coefficients to a kable table. What are the regresion coefficients for consc and agree?
\(\color{blue}{\text{-0.3960627, 0.0625336}}\)
(b). Produce a separate scatterplot between each of the Big 5 of personality and procrastination. Include a 80% neighborhood loess line for each scatterplot. Either produce five separate plots, or, as a challenge, create a single facet_wrap plot (Hint: One method involves restructuring the data to long format). Assess the linearity of the relationships between the Big 5 of personality and procrastination. Describe what you see in the plots.
\(\color{blue}{\text{For (proc~consc), the relationship seems negative as the line goes down. For (proc~neuro), the relationship is positive. The other relationships look negative, and all the relationships do not look strong. The outlier exit on all the plots, which need to be examined by using Residuals vs Leverage to examine.}}\)
### Q1
sel_stud <- students %>%
select(proc, consc, neuro,extra,intell, agree)
### Q1_a
mod <- lm(proc ~ consc + neuro + extra + intell + agree, data = sel_stud)
kable(coef(mod))
x | |
---|---|
(Intercept) | 3.2757114 |
consc | -0.3960627 |
neuro | 0.2336395 |
extra | -0.0662914 |
intell | -0.0551294 |
agree | 0.0625336 |
### Q2_b
p1 <- ggplot(data = sel_stud, mapping = aes(x = consc, y = proc)) +
## Point geomtry
geom_point() +
## loess line with 10% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.1, color = "red") +
## loess line with 25% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.25, color = "green") +
## loess line with 80% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.8, color = "blue")
p2 <- ggplot(data = sel_stud, mapping = aes(x = neuro, y = proc)) +
## Point geomtry
geom_point() +
## loess line with 10% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.1, color = "red") +
## loess line with 25% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.25, color = "green") +
## loess line with 80% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.8, color = "blue")
p3 <-ggplot(data = sel_stud, mapping = aes(x =extra, y = proc)) +
## Point geomtry
geom_point() +
## loess line with 10% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.1, color = "red") +
## loess line with 25% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.25, color = "green") +
## loess line with 80% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.8, color = "blue")
p4 <-ggplot(data = sel_stud, mapping = aes(x =intell, y = proc)) +
## Point geomtry
geom_point() +
## loess line with 10% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.1, color = "red") +
## loess line with 25% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.25, color = "green") +
## loess line with 80% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.8, color = "blue")
p5 <-ggplot(data = sel_stud, mapping = aes(x =agree, y = proc)) +
## Point geomtry
geom_point() +
## loess line with 10% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.1, color = "red") +
## loess line with 25% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.25, color = "green") +
## loess line with 80% neighborhood
geom_smooth(method = "loess", se = FALSE,
span = 0.8, color = "blue")
figure <- ggarrange(p1, p2, p3, p4, p5, labels = c("A", "B", "C","D","E"),
ncol = 3, nrow = 2)
## Warning: Removed 18 rows containing non-finite values (stat_smooth).
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 5.0187
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.26875
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0625
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
## Warning: Removed 18 rows containing non-finite values (stat_smooth).
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 3.5
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.25
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0625
## Warning: Removed 18 rows containing non-finite values (stat_smooth).
## Warning: Removed 18 rows containing missing values (geom_point).
## Warning: Removed 18 rows containing non-finite values (stat_smooth).
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 5.0175
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.5175
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 3.6022e-017
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0625
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
## Warning: Removed 18 rows containing non-finite values (stat_smooth).
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 3.25
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.25
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0625
## Warning: Removed 18 rows containing non-finite values (stat_smooth).
## Warning: Removed 18 rows containing missing values (geom_point).
## Warning: Removed 17 rows containing non-finite values (stat_smooth).
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 5.0175
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.5175
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 5.7155e-017
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0625
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
## Warning: Removed 17 rows containing non-finite values (stat_smooth).
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 3.5
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.25
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0625
## Warning: Removed 17 rows containing non-finite values (stat_smooth).
## Warning: Removed 17 rows containing missing values (geom_point).
## Warning: Removed 17 rows containing non-finite values (stat_smooth).
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 5.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.515
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0625
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
## Warning: Removed 17 rows containing non-finite values (stat_smooth).
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 3.5
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.25
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0625
## Warning: Removed 17 rows containing non-finite values (stat_smooth).
## Warning: Removed 17 rows containing missing values (geom_point).
## Warning: Removed 20 rows containing non-finite values (stat_smooth).
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 5.02
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.27
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0625
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
## Warning: Removed 20 rows containing non-finite values (stat_smooth).
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 3.75
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.25
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 0.0625
## Warning: Removed 20 rows containing non-finite values (stat_smooth).
## Warning: Removed 20 rows containing missing values (geom_point).
figure
Use a broom function to create an augmented data object named sel_stud_aug. In the augmented data object, add flag variables for the ordinary and internally and externally studentized residuals. Create a new data object named, crit_out, from sel_stud_aug.
(a). Create a boxplot showing all three types of residuals in one plot. Looking across the three types of residuals, how many unique individuals are outliers?
\(\color{blue}{\text{There is 4 outliers:73,47,10 for all residual types and 132 only for externally and internally residuals }}\)
(b). Print to kable all of the reisdual values for the individuals who are outliers. What is the internally studentized residual for individual 47? What is the ordinary residual for individual 132? What is the externally studentized residual for individual 10?
\(\color{blue}{\text{47 is outlier for the studentized residual, 132 is not outlier forthe ordinary residual,and 10 is outtlier for the externally studentized residual.}}\)
(c). Print to kable all of the individuals with an externally studentized residual greater than 3 in absolute value. Which individuals are extreme outliers?
\(\color{blue}{\text{10 and 73.}}\)
(d). Produce a plot of the internally studentized (standardized) residuals against the observation number. Which individuals are outliers with respect to the threshold of 2?
\(\color{blue}{\text{73 and -10.}}\)
(e). Produce an index plot of the leverage values with all individuals whose leverage is greater than 0.10 labelled in the plot. Which individuals have a leverage value greater than 0.10?
\(\color{blue}{\text{14,98,112 and 159.}}\)
(f). Produce a plot showing the externally studentized residuals against the leverage values. How many individuals does the plot label as extreme on residuals but not extreme on leverage? Which individuals are simultaneously extreme on residuals and leverage according to the thresholds in the plot?
\(\color{blue}{\text{11 individuals, and only one,132, which is extreme on residuals and leverages}}\)
### Q2
sel_stud_aug <- augment(mod, sel_stud)
sel_stud_aug <- sel_stud_aug %>%
## Add id variable
rownames_to_column(var = "id") %>%
## Add externally studentized residuals and outlier flags ---
mutate(ext_resid = rstudent(mod)) %>%
## Add outlier flags
mutate_at(
# Select variables
vars(.resid, .std.resid, ext_resid),
# Create function
list(out = ~ if_else(
# First part of condition
. < quantile(., 0.25) - 1.5*IQR(.) |
# Second part of condition
. > quantile(., 0.75) + 1.5*IQR(.),
# Result of condition test
TRUE, FALSE)))
summary(sel_stud_aug)
## id proc consc neuro
## Length:169 Min. :1.000 Min. :1.250 Min. :1.500
## Class :character 1st Qu.:2.100 1st Qu.:3.000 1st Qu.:3.000
## Mode :character Median :2.500 Median :3.750 Median :3.500
## Mean :2.465 Mean :3.587 Mean :3.439
## 3rd Qu.:2.900 3rd Qu.:4.000 3rd Qu.:4.000
## Max. :3.700 Max. :5.000 Max. :5.000
## extra intell agree .fitted
## Min. :1.500 Min. :2.000 Min. :1.000 Min. :1.496
## 1st Qu.:3.250 1st Qu.:3.250 1st Qu.:3.500 1st Qu.:2.234
## Median :3.500 Median :3.750 Median :4.000 Median :2.459
## Mean :3.571 Mean :3.652 Mean :3.913 Mean :2.465
## 3rd Qu.:4.000 3rd Qu.:4.000 3rd Qu.:4.250 3rd Qu.:2.678
## Max. :5.000 Max. :5.000 Max. :5.000 Max. :3.309
## .se.fit .resid .hat .sigma
## Min. :0.03869 Min. :-1.364671 Min. :0.007513 Min. :0.4345
## 1st Qu.:0.06261 1st Qu.:-0.285060 1st Qu.:0.019673 1st Qu.:0.4458
## Median :0.07840 Median : 0.007652 Median :0.030845 Median :0.4473
## Mean :0.08030 Mean : 0.000000 Mean :0.035503 Mean :0.4464
## 3rd Qu.:0.09269 3rd Qu.: 0.212483 3rd Qu.:0.043115 3rd Qu.:0.4477
## Max. :0.19804 Max. : 1.363473 Max. :0.196828 Max. :0.4478
## .cooksd .std.resid ext_resid .resid_out
## Min. :3.000e-08 Min. :-3.077597 Min. :-3.161367 Mode :logical
## 1st Qu.:2.584e-04 1st Qu.:-0.643433 1st Qu.:-0.642273 FALSE:166
## Median :1.707e-03 Median : 0.017295 Median : 0.017242 TRUE :3
## Mean :6.275e-03 Mean : 0.001597 Mean : 0.002185
## 3rd Qu.:8.290e-03 3rd Qu.: 0.479938 3rd Qu.: 0.478802
## Max. :8.874e-02 Max. : 3.085494 Max. : 3.169981
## .std.resid_out ext_resid_out
## Mode :logical Mode :logical
## FALSE:165 FALSE:165
## TRUE :4 TRUE :4
##
##
##
### Restructure data for plotting
## Choose data
crit_out <- sel_stud_aug %>%
## Select variablesadditive
select(id, .resid, .std.resid, ext_resid,
.resid_out, .std.resid_out, ext_resid_out) %>%
## Make data long format
pivot_longer(cols = c(.resid, .std.resid, ext_resid),
names_to = "resid_type", values_to = "resid_val")
### Q2a
### Boxplot of residuals
## Choose data and mapping
ggplot(data = crit_out, mapping = aes(x = resid_type, y = resid_val, fill = resid_type)) +
## Add boxplot
geom_boxplot() +
## Add text label
geom_text(aes(label = if_else(ext_resid_out, id, "")), size = 3, hjust = -0.5) +
## Add points
geom_jitter(width = 0.01, alpha = 0.2)
### Q2b
crit_out %>%
## Filter for relevant variable
filter_at(vars(.resid_out, .std.resid_out, ext_resid_out),
any_vars(.)) %>%
## Print
kable(caption = "Outlier Residuals")
id | .resid_out | .std.resid_out | ext_resid_out | resid_type | resid_val |
---|---|---|---|---|---|
10 | TRUE | TRUE | TRUE | .resid | -1.364671 |
10 | TRUE | TRUE | TRUE | .std.resid | -3.077597 |
10 | TRUE | TRUE | TRUE | ext_resid | -3.161367 |
47 | TRUE | TRUE | TRUE | .resid | 1.011369 |
47 | TRUE | TRUE | TRUE | .std.resid | 2.278706 |
47 | TRUE | TRUE | TRUE | ext_resid | 2.308777 |
73 | TRUE | TRUE | TRUE | .resid | 1.363473 |
73 | TRUE | TRUE | TRUE | .std.resid | 3.085494 |
73 | TRUE | TRUE | TRUE | ext_resid | 3.169981 |
132 | FALSE | TRUE | TRUE | .resid | 0.935909 |
132 | FALSE | TRUE | TRUE | .std.resid | 2.208187 |
132 | FALSE | TRUE | TRUE | ext_resid | 2.235088 |
### Q2c
### Identify large outliers
## Choose data
crit_out %>%
## Filter on externally studentized residuals
filter(resid_type == "ext_resid", abs(resid_val) >= 3) %>%
## Place in table
kable(caption = "Extreme Residuals")
id | .resid_out | .std.resid_out | ext_resid_out | resid_type | resid_val |
---|---|---|---|---|---|
10 | TRUE | TRUE | TRUE | ext_resid | -3.161367 |
73 | TRUE | TRUE | TRUE | ext_resid | 3.169981 |
### Q2d
ols_plot_resid_stand(mod)
### Q2e
### Create index plot
## Choose data and mapping
ggplot(data = sel_stud_aug, mapping = aes(x = as.numeric(id), y = .hat)) +
## Add boxplot
geom_point() +
## Add text label
geom_text(aes(label = if_else(.hat > 0.10, id, "")), size = 3, hjust = -0.10) +
## Labels
xlab("Index")
### Q2f
ols_plot_resid_lev(mod)
Using mod, answer and execute the following:
(a). Plot the dfbetas for mod. For agreeableness, how many individuals have a DfBetas value greater than the threshold?
\(\color{blue}{\text{8 individuals.}}\)
(b). Print all of the DfBetas values to kable. For which predictor, does individual 21 have the highest DfBetas absolute value? Does individual 137 or 171 have a higher DfBetas absolute value for conscientiousness?
\(\color{blue}{\text{Yes, there are. 137 =-0.08, 171 = -0.04, 21=0.02.}}\)
(c). Plot the dffits for mod. Which individual has a DfFits value greater than the negative threshold?
\(\color{blue}{\text{Type your responses inside these curly braces. Note: This is LaTeX syntax.}}\)
(d). Print all of the DfFits values to kable. How much does the standardized fitted value change in absolute terms for individual 184?
\(\color{blue}{\text{0.3.}}\)
(e). Plot the Cook’s distance for mod. Does individual 50 have a normal Cook’s distance value?
ols_plot_cooksd_bar(mod)
\(\color{blue}{\text{It does.}}\)
(f). Does any individual have an abnormal Cook’s distance value when compared to the 50th percentile of the corresponding F distribution?
\(\color{blue}{\text{Yes it does, 112,132.}}\)
### Q3a
## Plot
ols_plot_dfbetas(mod)
### Q3b
dfbetas(mod) %>%
## Print
kable(caption = "DfBetas")
(Intercept) | consc | neuro | extra | intell | agree | |
---|---|---|---|---|---|---|
1 | 0.0916991 | 0.0164484 | -0.1747360 | 0.0619060 | 0.0194990 | -0.0699683 |
2 | 0.0046204 | -0.0245262 | 0.0666703 | -0.0240517 | 0.0153203 | -0.0334036 |
3 | -0.0034092 | -0.0156553 | 0.0011157 | 0.0293050 | 0.0030304 | -0.0096846 |
4 | 0.0192188 | 0.0752026 | 0.0156769 | 0.0661697 | -0.0344385 | -0.1118863 |
5 | 0.0324024 | 0.1875191 | -0.0073264 | -0.1300185 | 0.0177724 | -0.0520453 |
6 | 0.0076125 | 0.0130656 | -0.0294374 | -0.0028897 | 0.0097648 | -0.0034049 |
10 | -0.0106754 | 0.0163659 | -0.0189163 | -0.0018012 | -0.0193408 | 0.0282120 |
11 | 0.0041962 | -0.0137750 | -0.0005362 | 0.0068558 | 0.0085199 | -0.0082897 |
12 | 0.0108148 | -0.0089805 | 0.0054920 | -0.0325887 | 0.0005453 | 0.0151827 |
13 | -0.1675288 | -0.0986436 | -0.0144000 | 0.1845693 | 0.1454929 | -0.0109469 |
14 | -0.0709108 | 0.1066801 | 0.2603897 | -0.0004869 | -0.0251371 | -0.0965383 |
15 | 0.0883792 | 0.0130009 | -0.0575471 | -0.0086609 | -0.1296041 | 0.0150627 |
16 | 0.0031764 | -0.0152524 | -0.0194597 | 0.0211339 | -0.0153180 | 0.0193436 |
17 | 0.0819071 | -0.2195538 | -0.0959014 | -0.0691597 | 0.1601458 | 0.0135305 |
18 | -0.0473368 | -0.0503867 | -0.0093636 | 0.0468902 | 0.0237098 | 0.0514754 |
19 | 0.1153612 | 0.0631714 | -0.2938882 | -0.2429811 | -0.0152649 | 0.2083452 |
20 | 0.0016247 | 0.0309399 | -0.0277288 | -0.0140669 | -0.0037426 | 0.0073801 |
21 | 0.0216065 | -0.0720508 | 0.0774789 | 0.0878246 | -0.0338592 | -0.0772344 |
23 | -0.0292196 | 0.0631163 | 0.0355604 | 0.0134684 | -0.0944597 | 0.0439895 |
24 | 0.0013950 | 0.0082229 | -0.0097480 | 0.0199819 | -0.0128096 | -0.0016081 |
25 | -0.0258634 | -0.0782962 | 0.0446126 | 0.0732549 | -0.0954553 | 0.0634686 |
26 | 0.0120887 | -0.0207778 | 0.0199928 | -0.0257978 | -0.0079651 | 0.0102349 |
28 | 0.0771904 | -0.0428347 | -0.1435777 | 0.1281056 | 0.0436641 | -0.1349246 |
29 | 0.0527717 | -0.0361563 | 0.0634054 | -0.2371055 | 0.0190790 | 0.0601242 |
30 | 0.0448089 | 0.0320978 | 0.0204129 | -0.0193252 | -0.1258107 | 0.0413318 |
31 | 0.0579636 | 0.0158029 | -0.0893342 | 0.1143603 | -0.0424918 | -0.0649501 |
32 | 0.0000613 | -0.0000055 | -0.0000766 | 0.0001143 | 0.0001860 | -0.0002487 |
33 | 0.0624726 | -0.0316201 | -0.0372075 | -0.0100160 | 0.0056694 | -0.0398072 |
35 | 0.0408876 | -0.0602160 | -0.0351577 | 0.0984319 | -0.0876241 | 0.0010269 |
36 | -0.0007780 | 0.0017989 | -0.0025846 | 0.0040189 | 0.0046411 | -0.0052625 |
37 | -0.0073234 | -0.0314228 | -0.0159010 | -0.0027965 | 0.0365926 | 0.0057175 |
38 | -0.0505138 | 0.0046559 | -0.0071353 | 0.0481885 | 0.0788189 | -0.0441858 |
39 | -0.0484125 | -0.1207637 | 0.1272944 | 0.0415323 | 0.0091255 | 0.0091564 |
40 | -0.0236084 | 0.0155646 | -0.0391648 | 0.0540543 | -0.0020685 | 0.0023756 |
41 | 0.0046024 | -0.0012839 | 0.0007542 | 0.0048173 | -0.0106180 | -0.0007294 |
42 | -0.3002652 | -0.0345826 | 0.2599355 | -0.1903794 | 0.2818705 | 0.1715560 |
43 | -0.0363501 | -0.0290638 | 0.0171749 | 0.0178261 | 0.0257301 | 0.0230563 |
44 | -0.0256741 | -0.0269302 | 0.0310784 | 0.0184426 | 0.0240325 | 0.0009745 |
45 | -0.0775631 | 0.1542689 | 0.1505686 | -0.0686786 | -0.1022525 | 0.0656977 |
46 | -0.0637960 | 0.0029842 | 0.0120783 | 0.0721715 | 0.0186550 | 0.0072432 |
47 | 0.0194421 | -0.1177522 | 0.0837814 | -0.0918904 | -0.0808177 | 0.1568888 |
48 | 0.0463345 | -0.0292650 | -0.0712254 | -0.0387777 | 0.0718759 | -0.0404450 |
49 | 0.0001408 | 0.0000866 | -0.0011284 | -0.0010959 | -0.0000647 | 0.0015464 |
50 | 0.0000763 | 0.0033585 | -0.0010265 | 0.0023634 | -0.0028785 | -0.0013396 |
51 | -0.0862806 | -0.0430290 | 0.0396335 | 0.0533065 | 0.0264278 | 0.0620215 |
52 | 0.0135053 | -0.0194641 | 0.0073275 | 0.0047821 | 0.0060534 | -0.0171807 |
53 | 0.0249749 | -0.0905151 | -0.0240724 | -0.0464027 | -0.0537298 | 0.1460968 |
54 | -0.0177604 | -0.0089017 | 0.0193896 | 0.0084127 | 0.0273631 | -0.0113796 |
55 | -0.0476414 | 0.0904997 | -0.0855082 | -0.1337873 | 0.0447294 | 0.1426646 |
57 | -0.1528101 | 0.0056493 | 0.1877199 | -0.0731514 | 0.1796728 | -0.0396283 |
58 | -0.0004553 | -0.0040768 | -0.0028159 | -0.0048333 | 0.0069196 | 0.0019126 |
59 | 0.1038025 | -0.0294064 | -0.0698610 | -0.0356557 | 0.0568527 | -0.0801809 |
61 | -0.0001657 | 0.0025463 | 0.0080147 | -0.0005310 | -0.0023897 | -0.0023899 |
62 | -0.0254236 | -0.0248524 | 0.0636303 | 0.0141162 | -0.0091469 | -0.0070612 |
63 | -0.0790341 | -0.1645025 | 0.1101008 | 0.0074066 | 0.1087674 | 0.0461618 |
65 | 0.0137731 | 0.0073728 | -0.0256174 | 0.0010064 | 0.0147178 | -0.0227353 |
66 | 0.0191986 | 0.0786979 | -0.0161519 | -0.0497805 | 0.0897508 | -0.1137801 |
67 | 0.0939603 | -0.0724442 | -0.0391238 | 0.1347793 | -0.0345406 | -0.1196153 |
68 | 0.0202062 | -0.0056109 | -0.0118630 | -0.0091256 | -0.0073239 | -0.0007623 |
69 | -0.0268535 | 0.0204200 | 0.0994618 | -0.0391491 | -0.0707729 | 0.0602468 |
70 | 0.0046572 | 0.0147912 | 0.0030215 | -0.0164030 | -0.0100070 | 0.0019216 |
71 | -0.0245359 | 0.0153734 | 0.0334091 | 0.0184340 | -0.0324351 | 0.0106490 |
73 | 0.1500678 | -0.0490171 | -0.0026130 | -0.1636882 | -0.0717532 | 0.0352160 |
74 | -0.0702226 | -0.0247016 | 0.0194800 | -0.0074645 | 0.0361936 | 0.0639176 |
75 | 0.0977394 | -0.0712327 | -0.1586503 | 0.0727374 | -0.0487917 | -0.0100441 |
76 | 0.2498857 | -0.0471890 | 0.0849666 | -0.3137740 | -0.2802243 | 0.1561936 |
77 | 0.0061466 | -0.0177125 | 0.0093116 | -0.0217684 | 0.0040074 | 0.0081040 |
78 | 0.0071064 | -0.0126283 | 0.0134755 | 0.0080282 | -0.0008809 | -0.0170126 |
79 | 0.1823395 | 0.0650420 | -0.0373099 | -0.0247826 | -0.0760557 | -0.1614967 |
80 | 0.0749608 | -0.0426804 | -0.2044144 | 0.1505995 | -0.0255454 | -0.0507322 |
81 | 0.0036386 | -0.0540783 | -0.0318075 | 0.0281829 | -0.0067890 | 0.0288122 |
82 | -0.2725235 | 0.1799980 | 0.0863332 | 0.2331493 | -0.1064800 | 0.1244460 |
83 | -0.0104983 | 0.1890940 | -0.0802088 | -0.1338927 | 0.2533251 | -0.1428840 |
84 | 0.0144365 | -0.0131778 | 0.0327320 | -0.0218587 | -0.0017552 | -0.0097336 |
85 | -0.0562685 | -0.0987678 | 0.0512886 | -0.0543286 | 0.1695217 | -0.0179692 |
86 | 0.0198723 | -0.0616580 | 0.0611159 | 0.0535152 | -0.2355914 | 0.1279683 |
88 | -0.0070907 | -0.0266254 | 0.0024425 | -0.0183205 | 0.0106728 | 0.0316892 |
90 | 0.0008038 | 0.0044130 | -0.0026250 | 0.0022723 | -0.0033752 | -0.0000964 |
93 | 0.0033161 | -0.0047310 | -0.0029849 | 0.0047237 | 0.0034643 | -0.0045383 |
94 | -0.0413984 | 0.0594173 | -0.1072458 | 0.0759416 | 0.1146585 | -0.0872870 |
95 | -0.0123059 | 0.2162678 | -0.0796907 | 0.0726153 | -0.0130201 | -0.1285243 |
96 | 0.0205472 | -0.0329327 | -0.0207246 | 0.1079446 | -0.0842311 | 0.0057610 |
97 | 0.0193059 | -0.0001395 | -0.0142103 | -0.0159799 | -0.0072362 | 0.0008955 |
98 | -0.0122581 | -0.0183967 | -0.0119613 | -0.0457962 | 0.0158358 | 0.0532029 |
100 | 0.0168194 | -0.0386301 | 0.1116996 | 0.0212612 | 0.1173658 | -0.1729215 |
101 | -0.0096518 | 0.0004405 | 0.0116162 | -0.0124304 | -0.0038754 | 0.0167545 |
103 | -0.0056298 | 0.0604941 | -0.0052641 | 0.0200966 | -0.0351528 | -0.0037176 |
104 | 0.0101177 | 0.0101604 | -0.0085076 | -0.0032275 | -0.0089625 | -0.0025340 |
105 | -0.0120513 | -0.0072394 | -0.0037722 | 0.0068219 | 0.0223945 | -0.0036671 |
106 | -0.0177138 | -0.0300936 | 0.0151293 | 0.0474001 | 0.0042188 | -0.0030192 |
107 | 0.0093938 | -0.0024334 | -0.0110761 | -0.0053835 | -0.0024410 | -0.0012552 |
108 | 0.0543550 | -0.0879932 | -0.0361889 | -0.0145289 | -0.0562172 | 0.0587375 |
109 | -0.0105785 | -0.1013267 | -0.1009267 | 0.0939734 | 0.0020560 | 0.0581243 |
110 | -0.0131532 | -0.0088127 | 0.0102016 | -0.0018578 | -0.0002927 | 0.0206964 |
112 | 0.0955300 | 0.3125445 | 0.1318603 | 0.0469046 | -0.3808869 | -0.1280888 |
113 | -0.0494918 | 0.1209911 | -0.0562042 | -0.0125482 | -0.0031081 | 0.0283469 |
114 | 0.0100673 | -0.0005327 | -0.0087894 | -0.0053880 | -0.0079004 | 0.0046474 |
115 | -0.0336538 | -0.0894286 | 0.0794397 | -0.0352554 | -0.0544949 | 0.1217216 |
116 | -0.0016685 | 0.0024495 | -0.0012855 | 0.0010602 | -0.0003607 | 0.0011416 |
117 | -0.0016613 | -0.0106607 | -0.0107462 | -0.0132522 | 0.0155530 | 0.0105500 |
118 | 0.0619275 | 0.0164137 | 0.0014286 | -0.0435293 | -0.0425995 | -0.0167692 |
119 | -0.0757866 | 0.0764484 | -0.0157801 | 0.0407485 | 0.0156579 | 0.0095731 |
120 | 0.0003973 | 0.0093155 | 0.0013008 | 0.0194680 | -0.0158470 | -0.0069607 |
121 | 0.0748437 | -0.0517205 | -0.0480436 | -0.0120327 | -0.0039630 | -0.0293752 |
122 | -0.0764997 | -0.1730316 | 0.1211740 | 0.1837866 | 0.0012229 | -0.0198283 |
123 | 0.0074829 | -0.0332055 | 0.0147482 | 0.0090234 | -0.0185274 | 0.0056697 |
124 | -0.0158817 | 0.0462653 | 0.0436106 | -0.0608558 | 0.0751094 | -0.0399493 |
125 | 0.0054319 | -0.0094892 | 0.0114875 | 0.0556448 | 0.0144697 | -0.0589260 |
126 | 0.0231219 | 0.0301532 | -0.0535520 | -0.0581391 | 0.0336490 | 0.0069686 |
127 | -0.0114440 | -0.0849430 | 0.0392935 | 0.0188063 | 0.0195376 | 0.0175846 |
128 | -0.0002737 | 0.0006451 | 0.0008802 | -0.0000296 | 0.0009699 | -0.0012512 |
129 | 0.5166166 | 0.0261794 | -0.2399338 | 0.0795488 | -0.1191539 | -0.4892456 |
130 | -0.0242004 | -0.0468605 | 0.0173201 | -0.0302763 | 0.0056112 | 0.0773231 |
131 | 0.0051108 | -0.0266030 | -0.0006665 | -0.0008567 | -0.0549915 | 0.0626474 |
132 | 0.0111690 | -0.0462845 | 0.0186978 | -0.0221056 | 0.0325576 | -0.0051379 |
134 | 0.0162744 | 0.0049406 | -0.0448622 | -0.0299622 | -0.0147207 | 0.0427651 |
135 | -0.0635136 | 0.0487950 | 0.0180368 | -0.0522656 | -0.0450212 | 0.1124485 |
136 | -0.0050605 | -0.0068624 | 0.0035868 | -0.0048910 | 0.0056176 | 0.0066664 |
137 | -0.0769517 | -0.1330472 | -0.0208423 | 0.0158162 | 0.1228560 | 0.0643564 |
138 | -0.0461150 | 0.1824054 | -0.0970266 | 0.0475175 | 0.0593203 | -0.0952005 |
139 | -0.0269528 | 0.0117461 | 0.0182957 | 0.0222438 | -0.0013198 | 0.0021004 |
141 | -0.0406853 | -0.0271686 | 0.0359298 | -0.0104534 | 0.0099522 | 0.0411885 |
142 | 0.0027230 | 0.0418498 | 0.0006213 | 0.0001623 | 0.0099771 | -0.0436984 |
143 | -0.0196936 | 0.0251492 | 0.0454753 | 0.0531176 | -0.0056722 | -0.0602928 |
144 | -0.0691921 | -0.0224073 | 0.0253660 | -0.0001907 | 0.0508123 | 0.0506702 |
145 | 0.0003188 | 0.0002832 | 0.0013612 | 0.0026848 | -0.0007236 | -0.0031361 |
146 | 0.0001686 | -0.0280884 | -0.0160267 | 0.0201553 | 0.0093246 | 0.0057908 |
147 | -0.0023570 | 0.0007717 | -0.0010139 | 0.0055778 | -0.0024680 | 0.0002661 |
148 | -0.0276576 | -0.0520413 | -0.0053397 | 0.0818997 | -0.0239785 | 0.0180437 |
149 | 0.0311682 | -0.0419826 | -0.0224228 | 0.0169672 | -0.0296541 | 0.0042000 |
150 | 0.0037455 | 0.0113169 | -0.0068260 | 0.0180222 | -0.0128459 | -0.0087846 |
151 | -0.1452054 | 0.0627884 | 0.3324096 | -0.3378154 | 0.5180420 | -0.2256175 |
152 | -0.0033046 | -0.0034729 | 0.0077705 | 0.0065246 | -0.0000448 | -0.0041240 |
154 | 0.0209933 | -0.0089205 | -0.0445242 | -0.0081782 | -0.0194492 | 0.0256807 |
155 | -0.0635599 | -0.1013799 | -0.0837699 | 0.1316884 | -0.0189438 | 0.1360574 |
156 | 0.0093367 | 0.0246487 | -0.0469238 | 0.0236225 | -0.0301873 | 0.0123579 |
157 | 0.0504220 | 0.0066146 | -0.0663032 | -0.0398577 | 0.0118713 | -0.0041424 |
158 | 0.0406849 | 0.1074076 | -0.2044723 | 0.1029358 | -0.1315426 | 0.0538502 |
159 | 0.0073378 | 0.0017790 | 0.0002686 | -0.0037301 | -0.0059896 | -0.0019191 |
160 | -0.1029525 | 0.1933510 | -0.0958654 | -0.0103593 | 0.0543369 | 0.0490086 |
161 | 0.1712797 | -0.1262293 | 0.1798796 | -0.1210654 | -0.1376336 | -0.0556239 |
162 | -0.0236787 | 0.0926248 | -0.1154239 | -0.2107611 | 0.1777667 | 0.0298500 |
163 | 0.0276234 | 0.0121937 | -0.0367689 | -0.0247064 | -0.0087155 | 0.0094627 |
165 | -0.0545902 | -0.0345224 | 0.1135415 | -0.0381446 | -0.0393929 | 0.0785777 |
166 | -0.1075809 | -0.0913348 | 0.0697594 | -0.0073123 | 0.0034187 | 0.1476033 |
167 | 0.0359556 | -0.0037279 | -0.0176798 | 0.0081242 | 0.0088118 | -0.0527126 |
168 | -0.0609552 | 0.0387443 | -0.0111019 | 0.0338583 | 0.0629333 | -0.0257226 |
169 | -0.1205580 | 0.0963845 | 0.0499941 | -0.0542842 | 0.1902825 | -0.0719245 |
170 | 0.0002329 | -0.0141493 | 0.0218903 | 0.1554264 | -0.1848720 | 0.0472419 |
171 | -0.0375237 | 0.0109367 | -0.0223711 | -0.0147383 | -0.0048542 | 0.0641092 |
172 | 0.0177076 | 0.1670595 | 0.0293749 | -0.0044601 | -0.1699529 | -0.0075969 |
173 | -0.0448252 | 0.0701561 | -0.1566682 | 0.1511330 | 0.1107670 | -0.0829859 |
174 | -0.0354088 | -0.0025814 | 0.0107087 | 0.0480941 | -0.0095401 | 0.0166723 |
175 | -0.0369480 | -0.0316014 | 0.0264468 | 0.0032362 | 0.0692008 | -0.0222686 |
176 | -0.0017857 | 0.0088511 | 0.0047302 | 0.0002239 | 0.0004438 | -0.0060245 |
177 | 0.0134110 | 0.0386433 | -0.0218868 | -0.0244459 | -0.0100562 | -0.0063052 |
178 | 0.0259451 | -0.0824358 | 0.1305616 | -0.1503829 | 0.1358014 | -0.0773410 |
179 | 0.0102129 | -0.0388816 | -0.1303180 | -0.0643274 | 0.0217488 | 0.1054761 |
180 | 0.3786729 | -0.0209525 | -0.1564802 | -0.1620285 | -0.1433651 | -0.1247745 |
181 | -0.0410543 | 0.0553495 | 0.1904473 | 0.0457838 | -0.0625211 | -0.0673250 |
182 | -0.0223583 | 0.0228964 | 0.0361298 | -0.0092754 | 0.0015403 | 0.0028368 |
183 | 0.0037682 | -0.0079277 | -0.0219488 | 0.0094428 | -0.0102224 | 0.0178109 |
184 | -0.1021706 | 0.2137903 | 0.0362059 | 0.1535721 | -0.1218155 | -0.0473435 |
185 | -0.0011039 | -0.0063465 | 0.0038114 | 0.0049581 | -0.0017058 | 0.0017787 |
186 | 0.0605673 | -0.1026823 | -0.0715686 | 0.0675307 | -0.1104075 | 0.0605846 |
187 | -0.0607952 | 0.0314073 | 0.0876815 | -0.0222904 | 0.0329394 | 0.0019830 |
189 | -0.0005778 | -0.0001136 | -0.0001025 | 0.0005656 | 0.0002014 | 0.0003351 |
190 | 0.0017664 | -0.0080781 | 0.0078055 | 0.0010061 | 0.0253704 | -0.0228291 |
191 | -0.0117104 | 0.0010870 | -0.0024522 | -0.0089085 | 0.0108910 | 0.0123654 |
### Q3c
ols_plot_dffits(mod)
dffits(mod)
## 1 2 3 4 5
## 0.2299364656 -0.1010161800 0.0371677557 -0.1522371675 0.2833091318
## 6 10 11 12 13
## 0.0404897416 -0.0598686016 0.0203187792 0.0386902743 -0.3656820009
## 14 15 16 17 18
## 0.3432467397 -0.1943213897 0.0552365304 0.2981343028 0.1194553903
## 19 20 21 23 24
## 0.4526263329 -0.0473187058 -0.1799855161 -0.1276144418 0.0368208957
## 25 26 28 29 30
## -0.2203969526 -0.0418935399 -0.2461982303 -0.2914001588 0.1469097235
## 31 32 33 35 36
## 0.1948836348 0.0003927446 -0.0817910630 -0.1586449115 0.0085230988
## 37 38 39 40 41
## -0.0575523112 -0.1097872958 -0.1947502527 -0.0749024256 -0.0129753897
## 42 43 44 45 46
## 0.4621958650 0.0612672516 0.0615760154 0.2790523765 0.0974140674
## 47 48 49 50 51
## 0.2541909046 -0.1402464977 0.0025639610 -0.0056691688 0.1413539107
## 52 53 54 55 57
## 0.0331095680 0.2474742985 0.0396622308 0.2898377160 -0.3023523131
## 58 59 61 62 63
## -0.0107926436 0.1855432760 0.0149286531 -0.1270550903 0.2130813864
## 65 66 67 68 69
## -0.0392617070 -0.1795112348 0.2083161467 0.0235712346 0.1488143946
## 70 71 73 74 75
## -0.0298317469 -0.0673066693 0.2221748172 -0.0951652506 -0.2232951249
## 76 77 78 79 80
## 0.4912671332 -0.0346623192 -0.0320228247 0.2310846725 -0.2738645102
## 81 82 83 84 85
## -0.0860778211 0.4329362723 0.4525109579 0.0511681294 -0.2236239024
## 86 88 90 93 94
## -0.2931844994 0.0436893796 0.0091198827 0.0155276721 -0.2133979213
## 95 96 97 98 100
## -0.2577880404 0.1543361489 -0.0272862285 -0.0735594406 0.2561467094
## 101 103 104 105 106
## -0.0242908267 0.0948345284 0.0193940575 -0.0277933359 0.0679893126
## 107 108 109 110 112
## -0.0314991087 -0.1465196220 -0.2035045425 0.0299321456 -0.5365371442
## 113 114 115 116 117
## -0.1553368611 0.0158734797 -0.1642927873 0.0039603199 -0.0294906575
## 118 119 120 121 122
## 0.0867076422 -0.1169700478 0.0273052561 -0.1072864991 -0.2928782082
## 123 124 125 126 127
## -0.0621352477 0.1661516557 0.0860668805 0.1097354851 0.0992514580
## 128 129 130 131 132
## 0.0023168668 0.6097471230 0.1044780384 0.0848895110 0.0637239411
## 134 135 136 137 138
## 0.0735038900 -0.1535867464 -0.0130084713 -0.2181857492 -0.2423120035
## 139 141 142 143 144
## 0.0377725313 -0.0747305193 -0.0659814586 -0.1018057457 0.0967586005
## 145 146 147 148 149
## -0.0046148381 0.0441213258 -0.0087715051 -0.1409368218 -0.0915286459
## 150 151 152 154 155
## 0.0268003705 0.7385869824 -0.0130916217 -0.0630111993 0.3024443714
## 156 157 158 159 160
## 0.0660214549 0.0889664061 0.2876910922 0.0111749826 0.2898105701
## 161 162 163 165 166
## -0.3682226903 -0.3577695433 0.0560962721 -0.1529342509 -0.1915375086
## 167 168 169 170 171
## -0.0687416957 -0.1067586561 -0.2638512978 0.2521509376 -0.0961927942
## 172 173 174 175 176
## -0.2465901143 0.3015745288 0.0669563264 -0.1146821006 0.0131208470
## 177 178 179 180 181
## -0.0657778634 -0.2733092254 -0.2314444646 0.3887749858 0.2541323347
## 182 183 184 185 186
## 0.0591039997 0.0384421495 -0.2939768420 0.0120183408 -0.2252987033
## 187 189 190 191
## 0.1241116316 0.0009768099 0.0376988950 -0.0221036636
### Q3d
### DfFits
## Calculation
dffits(mod) %>%
## Print
kable(caption = "DfFits")
x | |
---|---|
1 | 0.2299365 |
2 | -0.1010162 |
3 | 0.0371678 |
4 | -0.1522372 |
5 | 0.2833091 |
6 | 0.0404897 |
10 | -0.0598686 |
11 | 0.0203188 |
12 | 0.0386903 |
13 | -0.3656820 |
14 | 0.3432467 |
15 | -0.1943214 |
16 | 0.0552365 |
17 | 0.2981343 |
18 | 0.1194554 |
19 | 0.4526263 |
20 | -0.0473187 |
21 | -0.1799855 |
23 | -0.1276144 |
24 | 0.0368209 |
25 | -0.2203970 |
26 | -0.0418935 |
28 | -0.2461982 |
29 | -0.2914002 |
30 | 0.1469097 |
31 | 0.1948836 |
32 | 0.0003927 |
33 | -0.0817911 |
35 | -0.1586449 |
36 | 0.0085231 |
37 | -0.0575523 |
38 | -0.1097873 |
39 | -0.1947503 |
40 | -0.0749024 |
41 | -0.0129754 |
42 | 0.4621959 |
43 | 0.0612673 |
44 | 0.0615760 |
45 | 0.2790524 |
46 | 0.0974141 |
47 | 0.2541909 |
48 | -0.1402465 |
49 | 0.0025640 |
50 | -0.0056692 |
51 | 0.1413539 |
52 | 0.0331096 |
53 | 0.2474743 |
54 | 0.0396622 |
55 | 0.2898377 |
57 | -0.3023523 |
58 | -0.0107926 |
59 | 0.1855433 |
61 | 0.0149287 |
62 | -0.1270551 |
63 | 0.2130814 |
65 | -0.0392617 |
66 | -0.1795112 |
67 | 0.2083161 |
68 | 0.0235712 |
69 | 0.1488144 |
70 | -0.0298317 |
71 | -0.0673067 |
73 | 0.2221748 |
74 | -0.0951653 |
75 | -0.2232951 |
76 | 0.4912671 |
77 | -0.0346623 |
78 | -0.0320228 |
79 | 0.2310847 |
80 | -0.2738645 |
81 | -0.0860778 |
82 | 0.4329363 |
83 | 0.4525110 |
84 | 0.0511681 |
85 | -0.2236239 |
86 | -0.2931845 |
88 | 0.0436894 |
90 | 0.0091199 |
93 | 0.0155277 |
94 | -0.2133979 |
95 | -0.2577880 |
96 | 0.1543361 |
97 | -0.0272862 |
98 | -0.0735594 |
100 | 0.2561467 |
101 | -0.0242908 |
103 | 0.0948345 |
104 | 0.0193941 |
105 | -0.0277933 |
106 | 0.0679893 |
107 | -0.0314991 |
108 | -0.1465196 |
109 | -0.2035045 |
110 | 0.0299321 |
112 | -0.5365371 |
113 | -0.1553369 |
114 | 0.0158735 |
115 | -0.1642928 |
116 | 0.0039603 |
117 | -0.0294907 |
118 | 0.0867076 |
119 | -0.1169700 |
120 | 0.0273053 |
121 | -0.1072865 |
122 | -0.2928782 |
123 | -0.0621352 |
124 | 0.1661517 |
125 | 0.0860669 |
126 | 0.1097355 |
127 | 0.0992515 |
128 | 0.0023169 |
129 | 0.6097471 |
130 | 0.1044780 |
131 | 0.0848895 |
132 | 0.0637239 |
134 | 0.0735039 |
135 | -0.1535867 |
136 | -0.0130085 |
137 | -0.2181857 |
138 | -0.2423120 |
139 | 0.0377725 |
141 | -0.0747305 |
142 | -0.0659815 |
143 | -0.1018057 |
144 | 0.0967586 |
145 | -0.0046148 |
146 | 0.0441213 |
147 | -0.0087715 |
148 | -0.1409368 |
149 | -0.0915286 |
150 | 0.0268004 |
151 | 0.7385870 |
152 | -0.0130916 |
154 | -0.0630112 |
155 | 0.3024444 |
156 | 0.0660215 |
157 | 0.0889664 |
158 | 0.2876911 |
159 | 0.0111750 |
160 | 0.2898106 |
161 | -0.3682227 |
162 | -0.3577695 |
163 | 0.0560963 |
165 | -0.1529343 |
166 | -0.1915375 |
167 | -0.0687417 |
168 | -0.1067587 |
169 | -0.2638513 |
170 | 0.2521509 |
171 | -0.0961928 |
172 | -0.2465901 |
173 | 0.3015745 |
174 | 0.0669563 |
175 | -0.1146821 |
176 | 0.0131208 |
177 | -0.0657779 |
178 | -0.2733092 |
179 | -0.2314445 |
180 | 0.3887750 |
181 | 0.2541323 |
182 | 0.0591040 |
183 | 0.0384421 |
184 | -0.2939768 |
185 | 0.0120183 |
186 | -0.2252987 |
187 | 0.1241116 |
189 | 0.0009768 |
190 | 0.0376989 |
191 | -0.0221037 |
Using mod, answer and execute the following:
(a). Plot the externally studentized residuals against the fitted values. Perform the Breusch_Pagan test to evaluate homoscedastisticity of residuals. What does the test result suggest about homoscedasticity of residuals?
\(\color{blue}{\text{The variance of externally studentized residuals are different.}}\)
(b). Ccompute the deciles of the fitted values. Then, compute the variance of the residuals of each of the deciles. Finally, compute the ratio of the maximum to minimum variance of the residuals across the deciles. Does the ratio indicate evidence for heteroscedasticity?
\(\color{blue}{\text{The ration is 3.6 < 10 which means there is no violation.}}\)
### Q4a
ols_plot_resid_stud_fit(mod)
ols_test_breusch_pagan(mod)
##
## Breusch Pagan Test for Heteroskedasticity
## -----------------------------------------
## Ho: the variance is constant
## Ha: the variance is not constant
##
## Data
## --------------------------------
## Response : proc
## Variables: fitted values of proc
##
## Test Summary
## ----------------------------
## DF = 1
## Chi2 = 1.58885
## Prob > Chi2 = 0.2074905
###Q4b
#### Quantification of heteroscedasticity
### Create groups as a function of fitted values
## Choose data
homoscedast_check <- sel_stud_aug %>%
## Select variables
select(.fitted, .resid) %>%
## Create variable
mutate(fit_group = cut(.fitted,
quantile(.fitted,
probs = seq(0, 1, 0.1)),
include.lowest = TRUE))
### Summarize variance across groups
## Choose data
homoscedast_check %>%
## Group
group_by(fit_group) %>%
## Summarize variance
summarize(fit_var = var(.resid)) %>%
## Ungroup
ungroup() %>%
## Summarize max/min ratio
summarize(ratio = max(fit_var)/min(fit_var))
## # A tibble: 1 x 1
## ratio
## <dbl>
## 1 3.59
Using mod, answer and execute the following:
(a). Produce the empirical density plot of the externally studentized residuals. Overlay the theoretical normal distribution for these residuals. Does the plot suggest the residuals are sufficiently normally distributed?
\(\color{blue}{\text{Yes it does. It displays the normal distribution of the leptokurtic shape.}}\)
(b). Produce a Q-Q plot. Are the deviations from normality greater in the positive or negative 1-2 range of the theoretical quantiles?
\(\color{blue}{\text{It is greate in the positive.}}\)
### Q5a
### Density plot of residuals
## Choose data and mapping
ggplot(data = sel_stud_aug, mapping = aes(x = ext_resid)) +
## Empirical density
geom_density(color = "blue") +
## Theoretical density
stat_function(fun = dnorm, color = "red")
### Q5b
ols_plot_resid_qq(mod)
Calculate the tolerance and variance inflation factor for each of the predictors in mod. Are there any predictors very correlated with the other predictors?
\(\color{blue}{\text{No, there are all close to 1 in terms of tolerance and less than 10 in terms of VIF.The points fall approximately along the red line}}\)
ols_coll_diag(mod)$vif_t
## # A tibble: 5 x 3
## Variables Tolerance VIF
## <chr> <dbl> <dbl>
## 1 consc 0.867 1.15
## 2 neuro 0.967 1.03
## 3 extra 0.869 1.15
## 4 intell 0.864 1.16
## 5 agree 0.798 1.25