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.2 ✔ tibble 3.3.0
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.1.0
## ── 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)
Clean_Data <- read_excel("Clean_Data.xlsx")
View(Clean_Data)
With this data, I will be observing how federal funding specific to the Department of Housing and Urban Development’s Continuum of Care program and other factors influence the rate of homelessness within local communities.
Dependent Variable will be:
Independent Variables:
library(stats)
homelessmodel<-lm(`Overall Homeless` ~ `Total Amount Awarded` + `Total Amounts of Beds in 2022` + `Total Persons Exited PH to permanent destinations or Remained in PH for 6+ months (measure excludes PH-RRH) in 2022`, data = Clean_Data)
summary(homelessmodel)
##
## Call:
## lm(formula = `Overall Homeless` ~ `Total Amount Awarded` + `Total Amounts of Beds in 2022` +
## `Total Persons Exited PH to permanent destinations or Remained in PH for 6+ months (measure excludes PH-RRH) in 2022`,
## data = Clean_Data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -14006.7 -165.3 185.3 436.7 22048.6
##
## Coefficients:
## Estimate
## (Intercept) -3.910e+02
## `Total Amount Awarded` 1.397e-04
## `Total Amounts of Beds in 2022` 8.129e-01
## `Total Persons Exited PH to permanent destinations or Remained in PH for 6+ months (measure excludes PH-RRH) in 2022` -1.338e+00
## Std. Error
## (Intercept) 1.106e+02
## `Total Amount Awarded` 1.862e-05
## `Total Amounts of Beds in 2022` 3.011e-02
## `Total Persons Exited PH to permanent destinations or Remained in PH for 6+ months (measure excludes PH-RRH) in 2022` 1.363e-01
## t value
## (Intercept) -3.534
## `Total Amount Awarded` 7.503
## `Total Amounts of Beds in 2022` 27.001
## `Total Persons Exited PH to permanent destinations or Remained in PH for 6+ months (measure excludes PH-RRH) in 2022` -9.816
## Pr(>|t|)
## (Intercept) 0.000461
## `Total Amount Awarded` 4.63e-13
## `Total Amounts of Beds in 2022` < 2e-16
## `Total Persons Exited PH to permanent destinations or Remained in PH for 6+ months (measure excludes PH-RRH) in 2022` < 2e-16
##
## (Intercept) ***
## `Total Amount Awarded` ***
## `Total Amounts of Beds in 2022` ***
## `Total Persons Exited PH to permanent destinations or Remained in PH for 6+ months (measure excludes PH-RRH) in 2022` ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1883 on 372 degrees of freedom
## Multiple R-squared: 0.9031, Adjusted R-squared: 0.9023
## F-statistic: 1156 on 3 and 372 DF, p-value: < 2.2e-16
The multiple and adjusted r-squared values are .9031 and .9023, respectively. This means that 90% of the dependent variable is accounted for within the linear model. Each of the of the variables have a p-value of less than 0.001 making all of the the independent variables staticstically significant.
The estimates for each of these variables is as follows:
Total Amount Awarded: 1.397e-04 - This shows that for every dollar that a community has it adds .0014% of a person experiencing homelessness.
TotalAmounts of Beds in 2022: 8.129e-01 - This shows that for every dollar that a community has it adds .81% of a person experiencing homelessness.
Total Persons Exiting PH: -1.338e+00 - This shows that for every dollar that a community has it REDUCES 13% of a person experiencing homelessness.
plot(homelessmodel, which = 1)
Based on the above visualization of the linear model, it can be assumed that this model does not meet the assumption of linearity. In order to acheive this, it would recommended to log the variable(s) that are heavily skewed.