Posts

Showing posts from May, 2019

Online Statistics Tutor: Z-scores & Normal Probabilities

Image
During my days of teaching introductory statistics, students were often looking for additional resources to help them master the material. My hope is for this post to supplement and aid students who are being introduced to statistics, or anyone looking for refresher material. That being said, if there is a specific topic that you would like me to cover that is not found here, please mention this in the comments and I will do my best to produce a lesson for it. Normal Probability Normal probability is referring to making inference (coming to a conclusion and generalizing that conclusion to a population) about the likelihood of an event based upon the assumption the outcome is normally distributed. In short, assume normally distributed data in order to make inference. For example, let's assume human height is normally distributed. How likely is it that a man is over 5 feet 10 inches (70 in)? Let's say the population has a mean of 68 inches with a standard deviation of 4 i

Simple Bayesian Model (T-test) in R using either WinBUGs or JAGS.

Image
WinBUGs and JAGS (Just Another Gibbs Sampler) are convenient and effective tools for estimating bayesian models for your data. Both use an openBUGs style syntax, although they do have their differences (e.g. censored data, or matrix operations). Even more convenient is that there are packages that allow you to pass BUGs syntax, call the Gibbs sampler, and pull the MCMC chain(s) back all within R. For me, the choice of whether to use WinBUGS, or JAGS (or openBUGs for that matter) is more a question of what OS you are running. WinBUGs is a Windows application and JAGS runs on OSX. I've never attempted to run these on Linux, so if anyone knows, feel free to provide that in the comments. If you need to obtain WinBUGS or JAGS, click on the hyperlinks to download them. The data I'm using comes from the 2010 US Census Data. It contains the median age for men and women per "place". In census language, "place" typically refers to cities or towns. Some cleaning

Connecting R to An SQL Database (PostgreSQL, MySQL, Oracle)

While reading data into R isn't difficult, there are a variety of reasons why you would want R to directly pull data from a database. Whatever your situation, I will take you through the process of connecting R to that DB and querying data from it. My favorite SQL platform is PostgreSQL because of its simplicity and versatility. In other words, I use R for most things and PostgreSQL works well with R. You can obtain it here , if needed. I suggest that you download  RStudio if you do not already have it as it makes installing packages and other essential tasks easier. The following code is essentially the same for all SQL platforms, the difference being which R package you load. For postgreSQL we use, library( RPostgreSQL ) # for a local instance of postgres con<- dbConnect(dbDriver( "PostgreSQL" ) , dbname = "myDB" ,host = "localhost" ,port = "5432" ) # or to connect to a server it will look something like... con<- dbConnec

How to Get Started Playing Super Metroid / Link to the Past Crossover Randomizer.

I've purchased and enjoyed classic consoles like the Super Nintendo Classic and replayed some of the beloved games from my childhood. After redoing a game once, I'm good for a while, and am left hoping for some way to make it more interesting once the nostalgia wears off. One way to make classic games more interesting was to watch speed runs. I've been a fan of watching speed running classic games, like Super Metroid, for some time now. Recently, I noticed many runners starting to participate in randomizer races and was immediately fascinated. The dynamic is different than typical speed-running which focuses on runners mastering mostly repetitive strategies and precise execution. Admittedly, that is still quite entertaining, however, randomizers add a new dimension where you have to think through game logic in order progress. It also adds an element where your regular Joe can play the game and enjoy a new twist every time without spending countless hours mastering particu