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(pastecs)
## 
## Attaching package: 'pastecs'
## 
## The following objects are masked from 'package:dplyr':
## 
##     first, last
## 
## The following object is masked from 'package:tidyr':
## 
##     extract

Linear Regression

I am using my Texas Department of Family and Protective Services (DFPS) dataset to examine whether fiscal year and victim confirmation status are associated with the number of victims. I am interested in determining whether victim counts change over time and whether the number of victims differs between confirmed and not confirmed observations. I will use a linear regression model to examine these relationships.

Loading the Data

dfps_data <- read.csv("dfps_data.csv", check.names = FALSE)
head(dfps_data)
##   Fiscal Year Program     County    Region Confirmed Victims # of Victims
## 1        2025     DCI Hutchinson 1-Lubbock     Not Confirmed            1
## 2        2025     DCI    Lubbock 1-Lubbock     Not Confirmed           36
## 3        2025     DCI    Lubbock 1-Lubbock  Confirmed Victim            4
## 4        2025     DCI  Ochiltree 1-Lubbock     Not Confirmed            1
## 5        2025     DCI     Potter 1-Lubbock     Not Confirmed           13
## 6        2025     DCI     Potter 1-Lubbock  Confirmed Victim            1

I loaded the DFPS dataset into R to examine the information available for the analysis. The dataset includes the number of victims, fiscal year, and victim confirmation status, which are the variables I will use in my regression model.

str(dfps_data)
## 'data.frame':    3121 obs. of  6 variables:
##  $ Fiscal Year      : int  2025 2025 2025 2025 2025 2025 2025 2025 2025 2025 ...
##  $ Program          : chr  "DCI" "DCI" "DCI" "DCI" ...
##  $ County           : chr  "Hutchinson" "Lubbock" "Lubbock" "Ochiltree" ...
##  $ Region           : chr  "1-Lubbock" "1-Lubbock" "1-Lubbock" "1-Lubbock" ...
##  $ Confirmed Victims: chr  "Not Confirmed" "Not Confirmed" "Confirmed Victim" "Not Confirmed" ...
##  $ # of Victims     : chr  "1" "36" "4" "1" ...

Preparing the Data

The dependent variable is the number of victims (# of Victims). The independent variables are fiscal year (Fiscal Year) and victim confirmation status (Confirmed Victims). I selected these variables because I want to examine whether victim counts are associated with changes over time and differences in confirmation status.

The number of victims variable must be numeric for regression analysis, and confirmation status is treated as a categorical variable.

dfps_data$`# of Victims` <- as.numeric(dfps_data$`# of Victims`)
## Warning: NAs introduced by coercion
dfps_data$`Confirmed Victims` <- as.factor(dfps_data$`Confirmed Victims`)
regression_data <- dfps_data %>%
  select(`# of Victims`, `Fiscal Year`, `Confirmed Victims`)
regression_data <- na.omit(regression_data)

Creating the Linear Model

I created a linear regression model using the number of victims as the dependent variable and fiscal year and victim confirmation status as the independent variables. This model allows me to examine the relationship between each independent variable and victim counts while holding the other variable constant.

victim_model <- lm(`# of Victims` ~ `Fiscal Year` + `Confirmed Victims`,
                   data = regression_data)

Summary of the Linear Model

summary(victim_model)
## 
## Call:
## lm(formula = `# of Victims` ~ `Fiscal Year` + `Confirmed Victims`, 
##     data = regression_data)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -28.93 -22.13  -7.62  -0.34 895.21 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      -1670.3258   648.8012  -2.574  0.01008 *  
## `Fiscal Year`                        0.8295     0.3211   2.583  0.00984 ** 
## `Confirmed Victims`Not Confirmed    20.6207     1.9741  10.446  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 51.4 on 3113 degrees of freedom
## Multiple R-squared:  0.03571,    Adjusted R-squared:  0.03509 
## F-statistic: 57.65 on 2 and 3113 DF,  p-value: < 2.2e-16

The regression results show that the overall model is statistically significant, with an F-statistic of 57.65 and a p-value below 0.001. This indicates that fiscal year and victim confirmation status, considered together, are significantly associated with the number of victims in the dataset.

The model’s R-squared value is approximately 0.0357, meaning that fiscal year and confirmation status explain about 3.57% of the variation in victim counts. Although both variables are statistically significant, the model explains only a small portion of the differences in victim counts across observations. This suggests that other factors not included in the model may be important in understanding why victim counts vary.

Both independent variables are statistically significant at the 0.05 significance level. Fiscal year has a p-value of 0.00984, while victim confirmation status has a p-value below 0.001. Therefore, neither variable is statistically insignificant at this significance level. However, statistical significance does not necessarily mean that a variable explains a large amount of the variation in victim counts.

Interpreting the Results

The regression results indicate that fiscal year and victim confirmation status are both significantly associated with the number of victims in the DFPS dataset. However, the low R-squared value suggests that these two variables alone provide limited explanatory power.

The coefficient for fiscal year is approximately 0.8295, with a p-value of 0.00984. This means that for each additional fiscal year, the model predicts an increase of approximately 0.83 in the number of victims, holding confirmation status constant. This suggests a slight upward trend in victim counts over time. Although the relationship is statistically significant, the estimated increase for each additional year is relatively small.

The coefficient for “Not Confirmed” is approximately 20.6207, with a p-value below 0.001. Using “Confirmed Victim” as the reference category, this means that observations classified as not confirmed have a predicted victim count approximately 20.62 higher than observations classified as confirmed, holding fiscal year constant. This is a larger estimated difference than the one-year change associated with fiscal year, suggesting that confirmation status is an important factor associated with differences in recorded victim counts.

Overall, the results suggest that victim counts are associated with both fiscal year and confirmation status. However, because the model explains only about 3.57% of the variation in victim counts, most of the differences between observations remain unexplained by these two variables. Additional variables may be needed to better understand the patterns in the DFPS data. These findings show associations and do not establish that fiscal year or confirmation status causes changes in victim counts.

Testing the Assumption of Linearity

To evaluate the linearity assumption, I examined the residuals-versus-fitted plot using the first diagnostic plot produced by the linear regression model.

plot(victim_model, which = 1)

The residuals-versus-fitted plot shows that the residuals are generally scattered around zero, and the red smooth line appears roughly horizontal. This suggests that there is no strong curved pattern in the residuals and provides some support for the linearity assumption.

However, the residuals also include several unusually large positive values. The largest residual is approximately 895.21, indicating that the model substantially underpredicted the victim count for at least one observation. These large residuals suggest that the model does not fit all observations equally well and that some observations may have characteristics that are not adequately captured by the predictors.

Overall, the plot provides some support for the linearity assumption because there does not appear to be a strong curved pattern. However, the unusually large residuals indicate that the model may not explain certain observations well. These findings suggest that, although a linear model may be useful for examining the relationships between fiscal year, confirmation status, and victim counts, its limitations should be considered when interpreting the results.

Conclusion

The linear regression analysis found statistically significant relationships between fiscal year, victim confirmation status, and the number of victims in the DFPS dataset. Victim counts were predicted to increase slightly with each additional fiscal year, while observations classified as not confirmed had higher predicted victim counts than those classified as confirmed, holding fiscal year constant.

Despite these statistically significant findings, the model explained only about 3.57% of the variation in victim counts. This indicates that fiscal year and confirmation status alone do not explain most of the differences observed in the dataset. The residual plot also identified unusually large positive residuals, suggesting that the model does not fit all observations equally well. Overall, the regression provides evidence of associations between the selected variables and victim counts, but additional variables and further examination of the data may be needed to better understand the variation in victim counts.