Skip to content

Commit

Permalink
Add simple fmv change
Browse files Browse the repository at this point in the history
  • Loading branch information
Damonamajor committed Jul 17, 2024
1 parent 1c8782a commit dfff1ff
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Simple Test for fmv changes.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
test1 <- assessment_pin %>%
distinct(meta_pin, keep_all) %>%
select(meta_pin, pred_pin_initial_fmv, pred_pin_final_fmv) %>%
rename(pred_pin_initial_fmv_new = pred_pin_initial_fmv)

test2 <- assessment_pin_comparison %>%
select(meta_pin, pred_pin_initial_fmv, pred_pin_final_fmv) %>%
rename(pred_pin_initial_fmv_comp = pred_pin_initial_fmv)


test3 <- inner_join(test1, test2, by = "meta_pin") %>%
mutate(fmv_change_comp = pred_pin_initial_fmv_new - pred_pin_initial_fmv_comp)

test4 <- test3 %>%
filter(
fmv_change_comp >= quantile(fmv_change_comp, 0.025, na.rm = TRUE) &
fmv_change_comp <= quantile(fmv_change_comp, 0.975, na.rm = TRUE)
) %>%
mutate(
mean_value = mean(fmv_change_comp, na.rm = TRUE),
median_value = median(fmv_change_comp, na.rm = TRUE)
) %>%
ggplot(aes(x = fmv_change_comp)) +
geom_histogram(fill = "blue", color = "black", alpha = 0.7) +
geom_vline(aes(xintercept = mean_value, color = "Mean"), linetype = "dashed", linewidth = 1, show.legend = TRUE) +

Check warning on line 25 in Simple Test for fmv changes.R

View workflow job for this annotation

GitHub Actions / pre-commit

file=/home/runner/work/model-res-avm/model-res-avm/Simple Test for fmv changes.R,line=25,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 116 characters.
geom_vline(aes(xintercept = median_value, color = "Median"), linetype = "dashed", linewidth = 1, show.legend = TRUE) +

Check warning on line 26 in Simple Test for fmv changes.R

View workflow job for this annotation

GitHub Actions / pre-commit

file=/home/runner/work/model-res-avm/model-res-avm/Simple Test for fmv changes.R,line=26,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 120 characters.
scale_color_manual(
name = "Statistics",
values = c(Mean = "red", Median = "green"),
labels = c("Mean", "Median")
) +
labs(
x = "Change in FMV",
y = "Frequency"
) +
theme_minimal()


plot(test4)

0 comments on commit dfff1ff

Please sign in to comment.