library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.0.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(readr)
Workers_Compensation_Claims_Data <- read_csv("Workers__Compensation_Claims_Data.csv")
## Rows: 56 Columns: 18
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (18): Year, Subject employers, Subject employees, Accepted disabling cla...
## 
## ℹ 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.
library(dplyr)
library(readr)
Workers_Compensation_Claims_Data <- read_csv("Workers__Compensation_Claims_Data.csv")
## Rows: 56 Columns: 18
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (18): Year, Subject employers, Subject employees, Accepted disabling cla...
## 
## ℹ 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.
head(Workers_Compensation_Claims_Data)
## # A tibble: 6 × 18
##    Year `Subject employers` `Subject employees` `Accepted disabling claims`
##   <dbl>               <dbl>               <dbl>                       <dbl>
## 1  1968               49021              671900                       32509
## 2  1969               52191              700800                       35372
## 3  1970               52789              704300                       30338
## 4  1971               58768              732500                       30663
## 5  1972               62584              778800                       34835
## 6  1973               65788              820600                       36802
## # ℹ 14 more variables: `Est. accepted nondisabling claims` <dbl>,
## #   `Est. total accepted claims` <dbl>, `Denied claims` <dbl>,
## #   `Disabling claim denial rate` <dbl>, `Fatality claims` <dbl>,
## #   `Net PTD claims` <dbl>,
## #   `Rate: accepted disabling claims per 100 employees` <dbl>,
## #   `Rate: fatality claims per 100,000 employees` <dbl>,
## #   `Aggravation claims: Accepted disabling` <dbl>, …


``` r
workers_1<-lm(`Rate: accepted disabling claims per 100 employees`~`Fatality claims`+`Accepted disabling claims`+`Denied claims`,data=Workers_Compensation_Claims_Data)

plot(workers_1,which=1)

raintest(workers_1)
## 
##  Rainbow test
## 
## data:  workers_1
## Rain = 6.53, df1 = 27, df2 = 23, p-value = 1.077e-05
plot(workers_1,which=3)