Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add big misses from all years #323

Merged
merged 8 commits into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 61 additions & 1 deletion reports/performance/_model.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ iwalk(model_lorenz_curve_plots, ~ {

## Big Misses

Tables of the largest misses (in absolute terms) from the both the **test set** and **assessment set**. They show the four sales (one per quartile of sale price) from each township where the model's estimate was furthest from the actual sale price.
Tables of the largest misses (in absolute terms) from the **test set**, **assessment set**, and **training data**. The **Test Set** and **Assessment Set** tabs show the four sales (one per quartile of sale price) from each township where the model's estimate was furthest from the actual sale price. The **Training Data** tab shows the largest prediction misses by town across the entire time spanned by the training data, with the goal of identifying possible data integrity issues.

::: {.panel-tabset}

Expand Down Expand Up @@ -1259,6 +1259,66 @@ model_big_misses_assessment %>%
)
```

### Training Data

```{r _model_big_misses_training}
model_big_misses_training <- training_data_pred %>%
filter(!sv_is_outlier) %>%
mutate(township_name = ccao::town_convert(meta_township_code)) %>%
filter(meta_triad_code == run_triad_code, !is.na(meta_sale_price)) %>%
select(
Town = township_name, PIN = meta_pin, Card = meta_card_num,
Class = meta_class, NBHD = meta_nbhd_code, `Bldg Sqft` = char_bldg_sf,
Yrblt = char_yrblt,
`Sale Date` = meta_sale_date,
`Sale Price` = meta_sale_price,
`Est. FMV` = pred_card_initial_fmv
) %>%
mutate(
Difference = (`Est. FMV` - `Sale Price`),
.by = Town
) %>%
group_by(Town) %>%
summarise(
max_min_rows = list(bind_rows(
slice_max(pick(everything()), Difference, n = 4),
slice_min(pick(everything()), Difference, n = 4)
))
) %>%
unnest(max_min_rows) %>%
arrange(Town, -Difference) %>%
mutate(
across(
c(ends_with("Price"), ends_with("FMV"), Difference),
~ scales::dollar(.x, prefix = "$")
),
`Bldg Sqft` = scales::comma(`Bldg Sqft`)
)

model_big_misses_training %>%
datatable(
rownames = FALSE,
options = list(
columnDefs = list(
list(
className = "dt-right",
targets = c(
"Bldg Sqft",
"Sale Price",
"Sale Date",
"Est. FMV",
"Difference"
)
),
list(
className = "dt-nowrap",
targets = c("Sale Date")
)
)
)
)
```

:::

## Variance Over Time
Expand Down
Loading