John's Blog
/
Recent content on John's BlogHugo -- gohugo.ioenThu, 24 Oct 2019 00:00:00 +0000Using ggplot2 Inside data.table
/post/using-ggplot2-inside-data-table/
Thu, 24 Oct 2019 00:00:00 +0000/post/using-ggplot2-inside-data-table/I’m learning data.table. Recently I needed to plot a histogram of some particular columns. I already learned to use .SDcols and .SD to get at particular columns and subsets, but I couldn’t figure out how to refer to the column’s name in the plot itself.
Eventually I settled on the approach of mapping over the indices of the data set and getting the correct column data and name during each lapply iteration.Estimating the Internal Structure of the 2019-2021 DSA NPC
/post/estimating-structure-dsa-npc/
Sun, 20 Oct 2019 00:00:00 +0000/post/estimating-structure-dsa-npc/The Democratic Socialists’ of America 2019 National Convention was excellent and there has been a surfeit of great articles) about it. But despite all the writing about the convention, I had a thought which I have not seen addressed: what do the delegates’ ballots tell us about the internal structure of the new NPC? In particular, will the structure expressed in the ballots correspond to the candidates’ factional endorsements?
Social Networks I decided to tackle it with social network analysis.How Many Questions Do You Need on Your Exam?
/post/how-many-questions-do-you-need-on-your-exam/
Wed, 16 May 2018 00:00:00 +0000/post/how-many-questions-do-you-need-on-your-exam/Someone recently asked me a question that I found interesting. The question was as follows:
Your job is to write a test that can tell the difference between someone who has mastered the material and someone who is only guessing at random. What is the fewest number of questions that you need to tell the difference with a 95% probability?
In this case, mastery is defined as someone who has a greater than 50% chance of answering a question correctly and nonmastery is defined as someone who has a 25% chance of answering a question correctly.Visualizing Definite Integrals in R
/post/definite-integrals-r/
Tue, 08 May 2018 00:00:00 +0000/post/definite-integrals-r/## Registered S3 methods overwritten by 'ggplot2': ## method from ## [.quosures rlang ## c.quosures rlang ## print.quosures rlang Let’s do an integral. What is the total area under the curve \(f(x)=x^2\) from \(x=-1\) to \(x=2\) and from \(x=4\) to \(x=5\)? We typically write this as \(\int_{-1}^{2} x^2 \, dx + \int_{4}^{5} x^2 \, dx\). Remembering some elementary calculus, we have \[\int_{-1}^{2} x^2 \, dx + \int_{4}^{5} x^2 \,dx = \\\int_{-1}^{2} \frac{d}{dx} \frac{x^3}{3} \, dx + \int_{4}^{5} \frac{d}{dx} \frac{x^3}{3} = \\\left.New Blog
/post/first-blog/
Mon, 07 May 2018 00:00:00 +0000/post/first-blog/I’m excited to set up my new blog! I plan to post stuff I’m learning that I find cool. Some topics I have in mind are functional programming, becoming more proficient in Python, and reading Mostly Harmless Econometrics
I give special thanks to …
Yihu Xi for the excellent Blogdown package, Nan Xiao for the cool looking Hugo theme, and Tyler Clavelle for the walkthrough helping me to set up my blog.
/post/2018-05-07-hello-world-rmd/
Mon, 01 Jan 0001 00:00:00 +0000/post/2018-05-07-hello-world-rmd/New Blog code{white-space: pre;} pre:not([class]) { background-color: white; } if (window.hljs) { hljs.configure({languages: []}); hljs.initHighlightingOnLoad(); if (document.readyState && document.readyState === "complete") { window.setTimeout(function() { hljs.initHighlighting(); }, 0); } } h1 { font-size: 34px; } h1.title { font-size: 38px; } h2 { font-size: 30px; } h3 { font-size: 24px; } h4 { font-size: 18px; } h5 { font-size: 16px; } h6 { font-size: 12px; } .