library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.2.1 ✔ readr 2.2.0
## ✔ forcats 1.0.1 ✔ stringr 1.6.0
## ✔ ggplot2 4.0.3 ✔ tibble 3.3.1
## ✔ lubridate 1.9.5 ✔ tidyr 1.3.2
## ✔ purrr 1.2.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(lmtest)
## Loading required package: zoo
##
## Attaching package: 'zoo'
##
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(MASS)
##
## Attaching package: 'MASS'
##
## The following object is masked from 'package:dplyr':
##
## select
library(dplyr)
RLS_Model<-read_csv("RLS Public Use File Feb.csv")
## Rows: 36908 Columns: 654
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (631): P_SUID, YEAR_FROM_CODATE, HAPPY, SATIS_A, SATIS_B, CHNG_A, CHNG_B...
## lgl (23): REGION, DENOMREC2, FAMILY, PROTFAM, CURREL2, FRMREL2, SPREL, SPRE...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
RLS_Model_2<-lm(QB2C~RELTRAD+RELIMP+IDEO, data=RLS_Model)
plot(RLS_Model_2, which=1)
raintest(RLS_Model_2)
##
## Rainbow test
##
## data: RLS_Model_2
## Rain = 0.90164, df1 = 18454, df2 = 18450, p-value = 1
library(car)
## Loading required package: carData
##
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
##
## recode
## The following object is masked from 'package:purrr':
##
## some
durbinWatsonTest(RLS_Model_2)
## lag Autocorrelation D-W Statistic p-value
## 1 -0.001060806 2.002121 0.892
## Alternative hypothesis: rho != 0
bptest(RLS_Model_2)
##
## studentized Breusch-Pagan test
##
## data: RLS_Model_2
## BP = 368.86, df = 3, p-value < 2.2e-16
RLS_Model_3<-lm(QB2C~RELTRAD+RELIMP+IDEO, data=RLS_Model)
plot(RLS_Model_3, which=3)
bptest(RLS_Model_3)
##
## studentized Breusch-Pagan test
##
## data: RLS_Model_3
## BP = 368.86, df = 3, p-value < 2.2e-16
plot(RLS_Model_2, which=2)
plot(RLS_Model_3, which=2)
RLS_Model_4<-lm(QB2C~RELTRAD+RELIMP+IDEO+RELPER+MEMB, data=RLS_Model)
vif(RLS_Model_4)
## RELTRAD RELIMP IDEO RELPER MEMB
## 1.031135 1.131340 1.007328 1.052644 1.104573
I think that my models meet all the assumptions. I need to filter out the “99” placeholder for n/a resutls to clear out the charts and make them “prettier” and more readable for the viewer. But all my models/charts seem to follow the expected pathways without violating any of the assumptions. I was also extremely happy wit the low amounts of mulitcolinearity wich helps me show my variables are good and not “over-related” to each other in a correlation sense. This means that the data should not be skewed overall from the variables I have selected in the aboce data set.
As a note the Shapiro scale would not work on my dataset due to numbers being over 5000. It had to be removed to knit the file.