For an identical version of this readme that has the repo’s contents hidden: https://MetzgerSK.github.io/shinyElement
This repository houses 12* of the 12 Shiny apps from Using Shiny to Teach Econometric Models by Shawna K. Metzger (2021, Cambridge University Press). They are identical to the files in the book’s Code Ocean capsule of record here. (*LASSO_bchamp_lite is a stripped-down version of the twelfth app.)
By being in a GitHub repo, the 12* apps can be run directly via Binder using the links below. Other than clicking the link and waiting <~60 seconds, there’s nothing additional you need to install or do.
TL;DR: Click to launch an app.
Metzger, Shawna K. 2021. Using Shiny to Teach Econometric Models. Cambridge: Cambridge University Press.
The Element is available via CUP’s website, here.
whySurv mleLogit mleLM description below for more about all the maximum likelihood apps’ general properties.leastSq mleLM leastSq, mleLM displays a graph with the proposed best-fit line and fake data, and this line updates as students select different slope + intercept values.Note: After generating a dataset, you can view each app’s objective function by clicking the upper-right switch to “Formal,” then clicking the
button that appears next to “Current…Value.”
olsApp linRegEstms olsApp, focusing on efficiency. It compares the performance of different estimators in the presence of various classic linear regression assumption violations.leastSqLASSO leastSq, adapted for LASSO.LASSO_bchamp: Code Ocean capsule only (file sizes too big)Uses replication data from Nicholas Beauchamp’s “Predicting and Interpolating State-Level Polls Using Twitter Textual Data” (2017, American Journal of Political Science) to introduce students to LASSO models, allowing them to manually change λ’s value and observe the performance of the resulting predictive model. Also includes interactive data viewer to examine word usage on a state–date basis.
LASSO_bchamp_lite LASSO_bchamp, but stripped down to basic functionality to allow the app to be run from Binder. (No interactive data viewer.)predProbs predProbs 2.0 predProbs, but spiffed.predProbs_HMST predProbs, but modified to allow students to replicate the predicted probability tables from an actual published article. Target table: Table 3 in Hensel, Mitchell, Sowers, and Thyne’s “Bones of Contention” (2008, Journal of Conflict Resolution).predProbsMNL predProbs, but adapted to multinomial logit. Generates predicted probabilities for Mexican voters’ vote choice in the first round of the 2012 presidential election.Found built image, launching... appears under the “Build Logs” header (click ‘show’ link at header’s right to display the log), things are working fine.server running at https://... displays (it should auto-redirect), either type that URL manually into your browser or hit refresh. Rinse and repeat until the app loads.shiny/appName?token=... to rstudio/?token=.... (Others won’t be able to see your edits.) There are additional Shiny apps for regression models usually covered in MLE/GLM courses here.
1: You can also technically load another app from the GitHub repo by modifying your current Binder session. The end of the current app’s URL will be shiny/appName?token=.... Replace appName in the URL with the other app’s name and hit Enter to load. ↩