On average the model’s predictions are about $53,182.83 away from the actual values. THe closer the MAE’s value is to 0 the better the model is performing.
The large MSE can be due to the nature of the dataset and also outliers within the dataset.
# Assuming ZHVI_full is already loaded and filtered for Arizona as ZHVI_az
ZHVI_az <- ZHVI_filtered_M %>%
filter(State == "AZ" )
# Calculate the percentage change in ZHVI
ZHVI_changes <- ZHVI_az %>%
group_by(RegionName) %>%
summarize(
StartZHVI = first(ZHVI),
EndZHVI = last(ZHVI),
PercentChange = ((EndZHVI - StartZHVI) / StartZHVI) * 100
) %>%
ungroup() %>%
arrange(desc(PercentChange))
# Get the top 5 increases and decreases
top_increases <- ZHVI_changes %>% top_n(5, PercentChange)
top_decreases <- ZHVI_changes %>% top_n(-5, PercentChange)
# Visualizations
# Plot the top 5 increases
ggplot(top_increases, aes(x = reorder(RegionName, PercentChange), y = PercentChange)) +
geom_col() +
coord_flip() +
labs(title = "Top 5 Increases in ZHVI in Arizona", x = "Region", y = "Percent Change")

# Plot the top 5 decreases
ggplot(top_decreases, aes(x = reorder(RegionName, -PercentChange), y = PercentChange)) +
geom_col() +
coord_flip() +
labs(title = "Top 5 Decreases in ZHVI in Arizona", x = "Region", y = "Percent Change")
