The ANOVA test is based on the cleaned data from regression step, dedicated to show the association between variables and the outcome.
showing = function(x){
x %>%
broom::tidy() %>%
mutate(
p.value = format(p.value, scientific = TRUE, digits = 3)
) %>%
select(term, p.value) %>%
rows_delete(tibble(term = "Residuals")) %>%
rename(variable = term) %>%
knitr::kable()
}
res_year = aov(number_shoot ~ factor(year), data = nyc_fit_lm)
showing(res_year)
| variable | p.value |
|---|---|
| factor(year) | 7.81e-39 |
The p-value of the year variable is smaller than 0.05, thus we reject the null hypothesis and regard the year as statistically significant.
res_month = aov(number_shoot ~ factor(month), data = nyc_fit_lm)
showing(res_month)
| variable | p.value |
|---|---|
| factor(month) | 1.04e-13 |
The p-value of the month variable is smaller than 0.05, thus we reject the null hypothesis and regard the month as statistically significant.
nyc_boro = nyc_fit_lm %>%
rename(borough = boro)
res_boro = aov(number_shoot ~ factor(borough), data = nyc_boro)
showing(res_boro)
| variable | p.value |
|---|---|
| factor(borough) | 3.08e-115 |
The p-value of the borough variable is smaller than 0.05, thus we reject the null hypothesis and regard the borough as statistically significant.
res_smf = aov(number_shoot ~ factor(statistical_murder_flag), data = nyc_fit_lm)
showing(res_smf)
| variable | p.value |
|---|---|
| factor(statistical_murder_flag) | 6.97e-32 |
The p-value of the Statistical_murder_flag variable is smaller than 0.05, thus we reject the null hypothesis and regard the Statistical_murder_flag as statistically significant.
res_perpsex = aov(number_shoot ~ factor(perp_sex), data = nyc_fit_lm)
showing(res_perpsex)
| variable | p.value |
|---|---|
| factor(perp_sex) | 2.5e-41 |
The p-value of the sex of perpetrator variable is smaller than 0.05, thus we reject the null hypothesis and regard the sex of perpetrator as statistically significant.
res_perprace = aov(number_shoot ~ factor(perp_race), data = nyc_fit_lm)
showing(res_perprace)
| variable | p.value |
|---|---|
| factor(perp_race) | 6.74e-93 |
The p-value of the race of perpetrator variable is smaller than 0.05, thus we reject the null hypothesis and regard the race of perpetrator as statistically significant.
res_vicsex = aov(number_shoot ~ factor(vic_sex), data = nyc_fit_lm)
showing(res_vicsex)
| variable | p.value |
|---|---|
| factor(vic_sex) | 1.6e-34 |
The p-value of the sex of victims variable is smaller than 0.05, thus we reject the null hypothesis and regard the sex of victims as statistically significant.
res_vicrace = aov(number_shoot ~ factor(vic_race), data = nyc_fit_lm)
showing(res_vicrace)
| variable | p.value |
|---|---|
| factor(vic_race) | 1.35e-131 |
The p-value of the race of victims variable is smaller than 0.05, thus we reject the null hypothesis and regard the race of victims as statistically significant.
res_perp_age_group = aov(number_shoot ~ factor(perp_age_group), data = nyc_fit_lm)
showing(res_perp_age_group)
| variable | p.value |
|---|---|
| factor(perp_age_group) | 7.24e-56 |
The p-value of the perp_age_group variable is smaller than 0.05, thus we reject the null hypothesis and regard the perp_age_group as statistically significant.
res_vic_age_group = aov(number_shoot ~ factor(vic_age_group), data = nyc_fit_lm)
showing(res_vic_age_group)
| variable | p.value |
|---|---|
| factor(vic_age_group) | 5.3e-41 |
The p-value of the vic_age_group variable is smaller than 0.05, thus we reject the null hypothesis and regard the vic_age_group as statistically significant.