-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c8782a
commit dfff1ff
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 GitHub Actions / pre-commit
|
||
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 GitHub Actions / pre-commit
|
||
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) |