rsquaredacademy / blorr Goto Github PK
View Code? Open in Web Editor NEWTools for developing binary logistic regression models
Home Page: https://blorr.rsquaredacademy.com/
License: Other
Tools for developing binary logistic regression models
Home Page: https://blorr.rsquaredacademy.com/
License: Other
Similar to this
library(blorr)
model <- glm(honcomp ~ female + read + science, data = hsb2[-200, ], family = binomial(link = "logit"))
blr_gains_table(model)
#> Error: `.data` must have 199 rows, not 200
Add a plot for visualizing capture rate by decile
Add a shiny app for users to explore the package interactively.
Add a function to print WOE & IV for multiple variables.
Use symbols such as tick
and cross
only if the function is used in an interactive session.
Add decile wise lift chart
Add an interactive tutorial using the learnr
package.
Add a function blr_stepwise()
for step wise selection of predictors. It should include the following arguments:
model
: a binary logistic regression modelinclude
: predictors to be included in the model at the beginning of the step wise processenter
: significance level at which the predictor will enter the modelretain
: significance level at which the predictor will be retained in the modelAdd a function blr_step_forward()
for forward selection of predictors. It should include the following arguments:
model
: a binary logistic regression modelinclude
: the predictors to be included in the forward selectionenter
: significance level for entering the modelstop
: number of predictors to be added to the model before stopping forward selectiondetails
: if TRUE
, model summary will be printed to the console after each step. Default value is FALSE
Add function blr_influence_diag()
to create a panel of plots where the following are plotted against the observation id:
Currently, the end user can view the plot only for AIC in the following:
blr_step_aic_backward()
blr_step_aic_forward()
blr_step_aic_both()
The plots must be generated for BIC and deviance as well and the user must be able to choose the plot to be displayed.
Use patchwork to combine plots instead of gridExtra.
Use the standard template for README:
Integrate the logistic regression report template from reportr.
Add blr_fit_diag()
to create a panel of plots where the following are plotted against the fitted values:
Generate automated report for logistic regression. Check the report package.
Prepare for release:
devtools::check_win_devel()
rhub::check_for_cran()
Perform release:
devtools::check_win_devel()
(again!)devtools::submit_cran()
pkgdown::build_site()
Wait for CRAN...
Template from r-lib/usethis#338
Move shiny app to xplorerr package.
Use rlang
equivalents for errors, warnings and messages.
Import the shiny app from the xplorerr package.
Similar to this.
blr_model_fit_stats()
should compare model fit statistics for different models.
The following variable selection procedures should return the final model as an object of class glm()
:
blr_step_aic_forward()
blr_step_aic_backward()
blr_step_aic_both()
blr_step_p_forward()
blr_step_p_backward()
blr_step_p_both()
Prepare for release:
devtools::check_win_devel()
rhub::check_for_cran()
Perform release:
devtools::check_win_devel()
(again!)devtools::submit_cran()
pkgdown::build_site()
Wait for CRAN...
Template from r-lib/usethis#338
Add the following plots for residual diagnostics:
Hi,
I failed to install the package from CRAN/Github. Here are the few errors I found:
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : there is no package called 'rio'
Installed rio and tried again
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : there is no package called 'carData'
Installed carData and tried again
Error : .onLoad failed in loadNamespace() for 'checkmate', details:
call: NULL
error: 'import' is not an exported object from 'namespace:backports'
ERROR: lazy loading failed for package 'blorr'
What shall I do now?
sessionInfo() # For Reference
R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] httr_1.3.1 R6_2.2.2 tools_3.3.3 withr_2.1.1 curl_3.1 memoise_1.0.0
[7] knitr_1.19 git2r_0.18.0 digest_0.6.12 devtools_1.12.0
Add a function blr_step_backward()
for backward elimination. It should include the following arguments:
model
: a binary logistic regression modelinclude
: predictors to be included at the beginning of backward elimination processretain
: significance level at which the predictors will be retained in the modelstop
: number of predictors to be eliminatedWe are contacting you because you are the maintainer of blorr, which imports ggplot2 and uses vdiffr to manage visual test cases. The upcoming release of ggplot2 includes several improvements to plot rendering, including the ability to specify lineend
and linejoin
in geom_rect()
and geom_tile()
, and improved rendering of text. These improvements will result in subtle changes to your vdiffr dopplegangers when the new version is released.
Because vdiffr test cases do not run on CRAN by default, your CRAN checks will still pass. However, we suggest updating your visual test cases with the new version of ggplot2 as soon as possible to avoid confusion. You can install the development version of ggplot2 using remotes::install_github("tidyverse/ggplot2")
.
If you have any questions, let me know!
library(blorr)
model <- glm(
honcomp ~ female + read + science, data = hsb2,
family = binomial(link = "logit")
)
gtable <- blr_gains_table(model, hsb2)
#> New names:
#> * value -> value...1
#> * value -> value...2
#> Error: Can't subset columns that don't exist.
#> x Column `value` doesn't exist.
Created on 2020-04-29 by the reprex package (v0.3.0)
This then is one failure we see when testing this package against dplyr 1.0.0. This apparently comes from these lines in gains_table_prep()
:
response %>%
as_tibble() %>%
bind_cols(predict.glm(model, newdata = data, type = "response") %>%
as_tibble())
because both have value
column, so name repair kicks in.
Add blr_leverage_diag()
to create a panel of plots where the following are plotted against leverage:
Return plot objects instead of printing. Use the argument print_plot
with the default value TRUE
.
Prepare for release:
devtools::check_win_devel()
rhub::check_for_cran()
Perform release:
devtools::check_win_devel()
(again!)devtools::submit_cran()
pkgdown::build_site()
Wait for CRAN...
Template from r-lib/usethis#338
Use a line chart instead of bar chart for weight of evidence
Check the odds ratio estimates and confidence intervals when weights are specified in the regression model.
Hi,
I was wondering would it be possible to create a function that does model selection based on p values (like ols_step_both_p from the olsrr package). Specifically p values from ANOVA/Chi Square Test similar to the STEPWISE procedure in SAS (https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_logistic_sect029.htm)
Thank you!
Aaron
Users should be able to specify variables which must be included in the models using the include
argument and it should be available in the following procedures:
blr_step_p_forward()
blr_step_aic_forward()
blr_step_p_backward()
blr_step_aic_backward()
blr_step_p_both()
blr_step_aic_both()
Add a function to return the current version of the package on CRAN and GitHub.
Add the following:
The R code for computing concordance and discordance is extremely slow due to the double for loops. Rewrite the code in c++ to reduce the computation time.
Users should be able to select plot from the following libraries:
To arrange plots, use grid_plot()
in rbokeh and subplot()
in plotly.
blr_bivariate_analysis()
should be able to accommodate multiple predictors.
Add a print method for the two way segmentation of the response variable.
== CHECK RESULTS ========================================
checking examples ... ERROR
Running examples in ‘blorr-Ex.R’ failed
The error most likely occurred in:
> ### Name: blr_multi_model_fit_stats
> ### Title: Multi model fit statistics
> ### Aliases: blr_multi_model_fit_stats blr_multi_model_fit_stats.default
>
> ### ** Examples
>
> model <- glm(honcomp ~ female + read + science, data = hsb2,
+ family = binomial(link = 'logit'))
>
> model2 <- glm(honcomp ~ female + read + math, data = hsb2,
+ family = binomial(link = 'logit'))
>
> blr_multi_model_fit_stats(model, model2)
Error: Columns 1, 2 must be named.
Use .name_repair to specify repair.
Execution halted
checking tests ...
ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
Added/
Step Variable Removed AIC BIC C(p)
----------------------------------------------------------------------
1 x6 addition 18869.627 18885.434 18865.6270
2 x1 addition 18571.376 18595.087 18565.3760
3 x3 addition 18016.724 18048.338 18008.7240
4 x2 addition 16642.374 16681.891 16632.3740
5 x5 addition 16640.883 16688.304 16628.8830
6 x6 removal 16639.219 16678.736 16629.2190
----------------------------------------------------------------------══
testthat results
═══════════════════════════════════════════════════════════
OK: 76 SKIPPED: 28 FAILED: 1
1. Error: blr_multi_model_fit_stats prints the correct output
(@test-model-fit-stats.R#154)
Error: testthat unit tests failed
Execution halted
Currently, the end user cannot modify the appearance of the plots generated by blorr. The plots are useful for absolute beginners while others would want to generate the plots using their own code. To address this issue, all the functions used in generating data for the plots must be exported. Those users who are well versed with R plotting libraries will then be able to use the above exported functions to prep the data and then use their favorite library to generate the plots. The functions used for preparing data for the following plots must be exported:
Prepare for release:
devtools::check_win_devel()
rhub::check_for_cran()
Perform release:
devtools::check_win_devel()
(again!)devtools::submit_cran()
pkgdown::build_site()
Wait for CRAN...
Template from r-lib/usethis#338
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.