library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.6
## ✔ forcats 1.0.1 ✔ stringr 1.6.0
## ✔ ggplot2 4.0.1 ✔ tibble 3.3.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.2
## ✔ purrr 1.2.1
## ── 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(readxl)
library(readr)
Animal_Care_and_Control_Division_Annual_Statistics_1<-read_csv("Desktop/Applied Quantitative Methods/Animal_Care_and_Control_Division_Annual_Statistics-1.csv")
## Rows: 22 Columns: 17
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (17): Year, Number of Employees, Number of Division Vehicles, Annual Bud...
##
## ℹ 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.
Animalcare<-Animal_Care_and_Control_Division_Annual_Statistics_1
budget_model<-lm(`Annual Budget`~Year+`Number of Employees`+`Annual Adoption Revenue`,data=Animalcare)
summary(budget_model)
##
## Call:
## lm(formula = `Annual Budget` ~ Year + `Number of Employees` +
## `Annual Adoption Revenue`, data = Animalcare)
##
## Residuals:
## Min 1Q Median 3Q Max
## -107218 -74341 -5378 42159 187820
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -8.466e+07 1.046e+07 -8.095 2.07e-07 ***
## Year 4.177e+04 5.377e+03 7.767 3.72e-07 ***
## `Number of Employees` 1.155e+05 2.694e+04 4.289 0.000442 ***
## `Annual Adoption Revenue` -1.436e+00 1.064e+00 -1.350 0.193814
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 88020 on 18 degrees of freedom
## Multiple R-squared: 0.961, Adjusted R-squared: 0.9545
## F-statistic: 147.8 on 3 and 18 DF, p-value: 7.262e-13
plot(budget_model,which=1)
The independent variables: year, number of employees, and annual adoption revenue, have a close affect on the dependent variable since they could possibly determine the next year’s annual budget for the shelter. The model does meet the assumption of linearity.