Working Efficiently
I just read Bram Moolenaar’s Seven habits of effective text editing I think his three basic steps are great: While you are editing, keep an eye out for actions you repeat and/or spend quite a bit of time on. Find out if there is an editor command that will do this action quicker. Read the documentation, ask a friend, or look at how others do this. Train using the command. Do this until your fingers type it without thinking....
Visualizing Sound
My sister’s boyfriend’s band, Vertigo Drift, recently came out with a new EP called Phase 3. It seemed like the perfect excuse for me to play around with gganimate to create a music video. Reading Audio Files The tuneR package provides excellent functions for reading audio files. Let’s download an example wave file. url <- "http://freewavesamples.com/files/Alesis-Fusion-Acoustic-Bass-C2.wav" command <- paste("wget", url) system(command) Let’s use tuneR to read the file. library(tuneR) wave <- readWave("Alesis-Fusion-Acoustic-Bass-C2....
Trump vs Obama - a Battle of Words
This post applies natural language processing, machine learning, and data visualization to examine how word usage differs between Donald Trump and Barack Obama. I employ a number of excellent R libraries to download tweets, clean the associated text, and predict authorship based on word choice. Downloading Data The twitteR library makes it easy to download tweets through the Twitter API. To access Twitter’s API you need to create a new app using Twitter Application Management....
Custom Web Analytics
Piwik is the web analytics framework for hackers. By providing access to raw page view data, Piwik allows analysts to use general purpose tools for analysis. Piwik stores all of its data in a MySQL database. I’ve written an R library piwikr to download and clean the tables stored in Piwik’s database. To get started let’s connect to the database: library(piwikr) my_db <- src_mysql( host = "host.com", user = "andrew", password = "xxxxx", dbname = "piwik" ) Below I retrieve tables describing all visits to the site and all actions taken by visitors to the site....
Statistical Power Analysis
Control Group $(Y_0)$ Treatment Group $(Y_1)$ Mean $(\mu)$ Standard Deviation $(\sigma)$ Number of Observations $(n)$ Significance Level $(\alpha)$ Critical t = {{ vm.graph.info.xcrit[1] | number : 3 }} Noncentrality Parameter = {{ vm.graph.info.ncp | number : 3 }} Degrees of Freedom = {{ vm.graph.info.dof | number : 3 }} Power = {{ vm.graph.info.power | number : 3 }} Imagine a scientist planning to run an experiment. A power analysis can help answer questions like:...