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(ggplot2)
library(dplyr)
library(readxl)
library_patrons <- read_excel("library_patrons.xls")
Registered_Patrons_model <- lm(
`Registered Patrons` ~ `% of Patrons/Pop` + `AVG HH INCOME` + `EDUCATION BA OR HIGHER`,
data = library_patrons
)
summary(Registered_Patrons_model)
##
## Call:
## lm(formula = `Registered Patrons` ~ `% of Patrons/Pop` + `AVG HH INCOME` +
## `EDUCATION BA OR HIGHER`, data = library_patrons)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5838.7 -1679.3 -835.6 1408.0 11340.6
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1640.02002 805.94614 2.035 0.04501 *
## `% of Patrons/Pop` 8033.99053 2626.72232 3.059 0.00298 **
## `AVG HH INCOME` 0.01946 0.01543 1.261 0.21071
## `EDUCATION BA OR HIGHER` -48.01232 24.52510 -1.958 0.05359 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2724 on 84 degrees of freedom
## Multiple R-squared: 0.1679, Adjusted R-squared: 0.1382
## F-statistic: 5.649 on 3 and 84 DF, p-value: 0.001417
Adjusted R-Squared is .13 which means the model accounts for 13% of
patron registrations which is significantly low. The P-value of the over
all model is significant with a value of .001417 which is below the .05
treshold of significance.
Significant variable is the percetage of patrons/ population at .00298
and low significance for average household income and education level in
the household with values over the threshold of .05.
plot(Registered_Patrons_model,which=1)
This model violates the assumption of linearity,perhaps caused by one outlier that is creating a noticible deviation.