Graphs

Data Science and Beyblades

Introduction Beyblade has proven itself to be a strong-running franchise, spanning several TV series and toys. In the shows and on the boxes of said toys, there is an emphasis on the attributes of the beyblades: their Attack, Defense, and Stamina for each component that make up the beyblade. While the validity of these statistics can be questioned, one cannot help but wonder about the relationship between these three traits among the beyblades.

Presenting the Sachse, TX January 2020 Special Election Pre-runoff Results with R

Preface The contents of this blog post originate from the PDF version (https://github.com/robertschnitman/RS_Reports/blob/master/Polls/Sachse/sachse2020.pdf) and its GitBook equivalent (https://rs-sachse2020.netlify.com/). EDIT 2020-03-27: This post has been updated to use flextable instead of kableExtra to produce a cleaner table for HTML. The PDF and Gitbook reports use the latter, as it is better for PDFs. Introduction The purpose of this document is to demonstrate the utility of using the R programming language in reporting polls by walking through the process via the software itself.

Scatter-text Plots with Base R

To make scatter plots with text as points in Base R, we simply need to use plot(), set the scatter points to be white, and then plot the text with text(). # Trick R into not displaying points. with(mtcars, plot(wt ~ mpg, pch = 1, col = 'white', xlab = 'MPG', ylab = 'Weight', main = 'Weight vs. MPG')) # Plot the labels on the graph. with(mtcars, text(mpg, wt, row.

Using Residuals Percent in OLS Diagnostics

Many students (myself included) were taught to analyze the raw residuals when diagnosing regression models, but not in terms of percent. The benefit of the latter is that we can assess the relative magnitude of error from our regression model. To display the residuals as a percent (henceforth Residuals, %), let’s first load some necessary libraries. libs <- c('tidyverse', 'magrittr', 'ggthemes', 'gridExtra') # For each library, check if they are installed.