Posts | Jason Bryer

Posts

I was inspired by Kay Cichini recent post on creating a a tcl/tk dialog box for users to enter variable values. I am going to have a use for this very soon so took some time to make it a bit more generic. What I wanted is a function that takes a vector (of variable names) of arbitrary length, create a dialog box for an input for each, and return the values in a list.

CONTINUE READING

Following up on John Mount’s post on remembering symbol parameters in ggplot2, I decided to give it a try and included symbols, line types, and colors (based upon Earl Glynn’s wonderful color chart). Code follows below. require(ggplot2) require(grid) theme_update(panel.background=theme_blank(), panel.grid.major=theme_blank(), panel.border=theme_blank()) #Borrowed (i.e. stollen) from http://research.stowers-institute.org/efg/R/Color/Chart/ColorChart.R getColorHexAndDecimal <- function(color) { if(is.na(color)) { return(NA) } else { c <- col2rgb(color) return(sprintf("#%02X%02X%02X %3d %3d %3d", c[1],c[2],c[3], c[1], c[2], c[3])) } } Symbols ggplot(data=data.

CONTINUE READING

Revisiting a fun puzzle I remember first encountering as an undergraduate. Nice example of creating a plot in R using ggplot2. I also plot the probability of someone in the room having the same birthday as you. ## See http://en.wikipedia.org/wiki/Birthday_problem for an explanation of the problem require(ggplot2) require(reshape) theme_update(panel.background=theme_blank(), panel.grid.major=theme_blank(), panel.border=theme_blank()) birthday <- function(n) { 1 - exp( - n^2 / (2 * 365) ) } myBirthday <- function(n) { 1 - ( (365 - 1) / 365 ) ^ n } d = 200 df = data.

CONTINUE READING

Constructor Define S3 generic method for the print function. Test code As someone who was a Java programmer for many years learning R’s object oriented programming framework has been frustrating to say the least. I like the simplicity of S3 but find it limiting when you wish to write methods that change the underlying data elements.

CONTINUE READING

I have been working on a new package makeR to help manage Sweave projects where you wish to create multiple versions of documents that are based on a single source. For example, I create lots of monthly and quarterly reports using Sweave and the only differences between versions are a few variables. I have used GNU make and Apache ANT but wanted a 100% R solution. I will have more to write about that project in a few weeks.

CONTINUE READING

I have become quite a big fan of graphics that combine the features of traditional figures (e.g. bar charts, histograms, etc.) with tables. That is, the combination of numerical results with a visual representation has been quite useful for exploring descriptive statistics. I have wrapped two of my favorites (build around ggplot2) and included them as part of my irutils R package (currently under development). Here is the code and results utilizing two item from the 2009 Programme of International Student Assessment (PISA).

CONTINUE READING

This a PDF of the poster I will be presenting at the Division of Educational Psychology & Methodology annual poster session on May 2, 2011.

Comparing Public & Private Schools: An International Perspective using Multilevel Propensity Score Analysis

CONTINUE READING

Here is a quick analysis of the relationship between SAT score and student retention. The data is from the Integrated Postsecondary Education Data System (IPEDS) and analyzed using R. This was a quick analysis and would be careful about making any strong conclusions. The source for running this analysis along with some additional graphics that are not included in this post. Here are the results of the regression analysis: Estimate Std.

CONTINUE READING

Gapminder has posted an interesting chart using world development indicators from the World Bank. I thought it would be a good exercise to recreate this chart using R and ggplot2. While playing with the data, not log transforming GDP provides some interesting, and perhaps different, interpretation. The R script and graphics are below. Google Gadget Version library(ggplot2) library(reshape) countries = read.csv('Data/WDI_GDF_Country.csv', strip.white=TRUE) worldData = read.csv('Data/WDI_GDF_Data.csv', strip.white=TRUE) worldData2 = worldData[which(worldData$Series.

CONTINUE READING