Code Monkey home page Code Monkey logo

cmfproperty's People

Contributors

cmf-uchicago avatar erhla avatar jrockower avatar ymericson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cmfproperty's Issues

Update documentation with pkgdown for satrday 2020 talk

README

pkgdown

  • Add tab for example report & example report w/ diagnostics
  • Update reference page to group functions into data processing, regressivity tests, plots, and report
  • Link vignettes to each other when appropriate

vignettes

  • preprocessing---more detailed step-by-step example of how to get data in correct format
  • methods---example of output applied for each function & latex equations behind functions (include arm's length/inflation adj) rename to Methods?
  • list of figures---example of output applied for each function
  • Get Started---motivation and overview

plots

  • split plots up into different sections

regressivity_tests

  • update documentation to refer to Methods

Non deterministic IAAO statistics

Hey @erhla --

In the process of replicating the COD, PRD, and PRB statistics generated via the make_report function I noticed that all three IAAO stats were slightly different from what you'd get if you were to manually compute them. I believe bootstrapping is a good solution for estimating errors but unsure if that is the best choice for estimating the actual IAAO performance indices. Or alternatively perhaps what you can do is provide an option in the make_reports fucntion to generate the statistics without bootstrapping.

As a comparison this is what I got manually computing them without bootstrapping vs using make_report:

  • COD 40.4 (manual) vs 34.55 (make_report)
  • PRD 1.12 (manual) vs 0.843, 1.058, 1.312, 1.177, 1.027 (make_report .. this was least stable)
  • PRB -0.1071028 (manual) vs -0.088 (make_report)

Below is the function I used modeled directly after your code w/o bootstrapping (referencing this: https://github.com/cmf-uchicago/cmfproperty/blob/master/R/iaao_stats.R#L1-L33)

#' @param data dataframe of data
#' @param assessment_value_col string of assessment_value_col name
#' @param sale_price_col string of sale_price_col name
#' @return dataframe 
gen_iaao_stats <- function(data, assessment_value_col, sale_price_col) { 
  df_iaao <- data %>% 
    rename_at(vars(c(assessment_value_col, sale_price_col)), function(x) c('assessment_value','sale_price')) %>% 
    mutate(av_ratio = assessment_value/sale_price,
           log2 = log(2),
           count = 1) %>%
    mutate(cod = 100 * sum(abs(av_ratio - stats::median(av_ratio)))/(n() * stats::median(av_ratio)),
           prd = mean(av_ratio, na.rm = TRUE)/stats::weighted.mean(av_ratio, sale_price, na.rm = TRUE),
           prb_value = 0.50 * (assessment_value/median(av_ratio)) + 0.50 * sale_price,
           prb_ln_value = log(prb_value)/log(2),
           prb_pct_diff = (av_ratio - median(av_ratio))/median(av_ratio)
    )
  prb_model <- linear_reg() %>% 
    fit(prb_pct_diff ~ prb_ln_value,  data = df_iaao) %>%
    tidy(., conf.int = TRUE) 
  iaao_out <- list('cod' = c(unique(df_iaao$cod)) ,
                   'prd' = c(unique(df_iaao$prd)) ,
                   'prb' = c(prb_model %>% filter(term == 'prb_ln_value') %>% select(estimate) %>% distinct() %>% pull())) %>%
    as.data.frame()
  return(iaao_out)
}
test <- gen_iaao_stats(data = data_input, assessment_value_col = 'ASSESSEDVALUE', sale_price_col = 'sale_price')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.