Package: shinymrp 0.10.0

Toan Tran

shinymrp: Interface for Multilevel Regression and Poststratification

Dual interfaces, graphical and programmatic, designed for intuitive applications of Multilevel Regression and Poststratification (MRP). Users can apply the method to a variety of datasets, from electronic health records to sample survey data, through an end-to-end Bayesian data analysis workflow. The package provides robust tools for data cleaning, exploratory analysis, flexible model building, and insightful result visualization. For more details, see Si et al. (2020) <https://www150.statcan.gc.ca/n1/en/pub/12-001-x/2020002/article/00003-eng.pdf?st=iF1_Fbrh> and Si (2025) <doi:10.1214/24-STS932>.

Authors:Toan Tran [cre, aut, cph], Jonah Gabry [aut, cph], Yajuan Si [aut, cph]

shinymrp_0.10.0.tar.gz
shinymrp_0.10.0.zip(r-4.7-any)shinymrp_0.10.0.zip(r-4.6-any)shinymrp_0.10.0.zip(r-4.5-any)
shinymrp_0.10.0.tgz(r-4.6-any)shinymrp_0.10.0.tgz(r-4.5-any)
shinymrp_0.10.0.tar.gz(r-4.7-any)shinymrp_0.10.0.tar.gz(r-4.6-any)
shinymrp_0.10.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
shinymrp/json (API)

# Install 'shinymrp' in R:
install.packages('shinymrp', repos = c('https://mrp-interface.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/mrp-interface/shinymrp/issues

Pkgdown/docs site:https://mrp-interface.github.io

On CRAN:

Conda:

bayesianguimcmcmrpmultilevel-modelspoststratificationshiny

6.36 score 6 stars 21 scripts 241 downloads 7 exports 115 dependencies

Last updated from:93a48e4fe8. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK199
source / vignettesOK515
linux-releaseOK158
macos-releaseOK229
macos-oldrelOK276
windows-develOK121
windows-releaseOK113
windows-oldrelOK129
wasm-releaseOK147

Exports:example_modelexample_pstrat_dataexample_sample_datamrp_workflowMRPModelMRPWorkflowrun_app

Dependencies:abindaskpassassertthatattemptbackportsbase64encbitbit64broombsiconsbslibcachemcheckmateclicliprcodetoolscommonmarkconfigcpp11crayoncrosstalkcurldata.tabledigestdistributionaldplyrDTevaluatefarverfastmapfontawesomefsgenericsggplot2gluegolemgtablehighcharterhighrhmshtmltoolshtmlwidgetshttpuvhttr2igraphisobandjquerylibjsonliteknitrlabelinglaterlatticelazyevallifecycleloolubridatemagrittrMatrixmatrixStatsmemoisemimenumDerivopensslotelpatchworkpillarpkgconfigposteriorprettyunitsprogresspromisespurrrqs2quantmodR6rappdirsRColorBrewerRcppRcppParallelreadrrjsonrlangrlistrmarkdownS7sassscalesshinyshinyjsshinyWidgetssourcetoolsstringfishstringistringrsystensorAtibbletidyrtidyselecttimechangetinytexTTRtzdbutf8vctrsviridisLitevroomwaiterwithrxfunXMLxtablextsyamlzoo

Spatial prior specification in shinymrp
1. Areal data & neighborhood graph | 2. Intrinsic Conditional Auto-Regressive (ICAR) models | 2.1 Stan implementation | 3. BYM2 model | 3.1 BYM2 reparameterization for disconnected graphs | 3.2 Stan implementation for both connected and disconnected graphs | 4. Case study: COVID infection estimation | References

Last update: 2025-12-04
Started: 2025-12-04

Programmatic workflow demonstration
Initializing the workflow | 1. Data preparation | 1.1 Preprocessing the sample data | 1.2 Assembling poststratification data | 1.2.1 Linking to ACS | 1.2.2 Importing custom poststratification data | 2. Descriptive statistics | 3. Model building | 3.1 Model specification | 3.2 Model fitting | 3.3 Posterior summaries and diagnostics | 3.4 Saving and loading models | 4. Result visualization | Further reading

Last update: 2025-12-01
Started: 2025-07-18

More on data preparation
Data requirements | Individual-level vs. aggregated data | Required columns and naming conventions | Data modules | Data preprocessing steps | Geographic identifiers and covariates | Poststratification tables

Last update: 2025-11-24
Started: 2025-07-18

More examples of R6 classes
MRPWorkflow | compare_models() | covar_hist() | create_model() | demo_bars() | estimate_map() | estimate_plot() | link_acs() | load_pstrat() | outcome_map() | outcome_plot() | pp_check() | preprocess() | preprocessed_data() | sample_size_map() | MRPModel | check_estimate_exists() | check_fit_exists() | diagnostics() | fit() | formula() | metadata() | model_spec() | save() | stan_code() | summary()

Last update: 2025-11-11
Started: 2025-09-18

MRP methodological guide
MRP for cross-sectional data | MRP for time-varying data with measurement error | More readings

Last update: 2025-10-06
Started: 2025-10-03

Getting started with shinymrp
Overview | Key steps | 1. Data preparation | 2. Descriptive statistics | 3. Model building | 4. Result visualization | Additional resources

Last update: 2025-10-06
Started: 2025-06-26

Readme and manuals

Help Manual

Help pageTopics
Return example 'MRPModel' object with estimation results.example_model
Return example poststratification dataexample_pstrat_data
Return example dataexample_sample_data
Create a new MRPWorkflow objectmrp_workflow
MRPModel objectsMRPModel
Check if poststratification has been performedcheck_estimate_exists MRPModel-method-check_estimate_exists
Check if model has been fittedcheck_fit_exists MRPModel-method-check_fit_exists
Return sampling diagnosticsdiagnostics MRPModel-method-diagnostics
Fit multilevel regression model using cmdstanrfit MRPModel-method-fit
Return model formulaformula MRPModel-method-formula
Create inputs for leave-one-out cross-validationlog_lik MRPModel-method-log_lik
Return model metadata.metadata MRPModel-method-metadata
Return model specificationmodel_spec MRPModel-method-model_spec
Run poststratification to generate population estimatesMRPModel-method-poststratify poststratify
Create input for posterior predictive checkMRPModel-method-ppc ppc
Save model object to fileMRPModel-method-save save
Return model Stan code.MRPModel-method-stan_code stan_code
Return posterior summary tableMRPModel-method-summary summary
MRPWorkflow objectsMRPWorkflow
Compare models using LOO-CVcompare_models MRPWorkflow-method-compare_models
Create geographic covariate distribution histogramcovar_hist MRPWorkflow-method-covar_hist
Create a new MRPModel objectcreate_model MRPWorkflow-method-create_model
Create demographic comparison bar plotsdemo_bars MRPWorkflow-method-demo_bars
Create a choropleth map of MRP estimatesestimate_map MRPWorkflow-method-estimate_map
Visualize estimates for demographic groupsestimate_plot MRPWorkflow-method-estimate_plot
Link sample data to ACS datalink_acs MRPWorkflow-method-link_acs
Load custom poststratification dataload_pstrat MRPWorkflow-method-load_pstrat
Visualize raw outcome measure by geographyMRPWorkflow-method-outcome_map outcome_map
Create summary plots of the outcome measureMRPWorkflow-method-outcome_plot outcome_plot
Perform posterior predictive checkMRPWorkflow-method-pp_check pp_check
Preprocess sample dataMRPWorkflow-method-preprocess preprocess
Return preprocessed sample dataMRPWorkflow-method-preprocessed_data preprocessed_data
Create sample size mapMRPWorkflow-method-sample_size_map sample_size_map
Run the Shiny Applicationrun_app