Blog Archives

The average Stripe employee! Congrats to Alyssa!

January 2, 2015
By
The average Stripe employee! Congrats to Alyssa!

Recently, my colleague and fellow blogger Alyssa Frazee accepted a job at Stripe. All of us at JHU Biostat are happy for her, yet sad to see her go. While perusing Stripe’s website, I found the About page, where each employee has a photo of themselves. I’ve been playing around with some PCA and decompositions,

Read more »

Adding Cost Functions to ROCR performance objects

December 22, 2014
By
Adding Cost Functions to ROCR performance objects

In my last post, I gave an introduction of the ROCR package and how to use it for ROC analysis. In the ROCR reference manual, it states “new performance measures can be added using a standard interface”, but I have not found that to be so. I may have missed some crucial step, but others

Read more »

A small introduction to the ROCR package

December 19, 2014
By
A small introduction to the ROCR package

I've been doing some classification with logistic regression in brain imaging recently. I have been using the ROCR package, which is helpful at estimating performance measures and plotting these measures over a range of cutoffs. The prediction and performance functions are the workhorses of most of the analyses in ROCR I've been doing. For those

Read more »

My Commonly Done ggplot2 graphs: Part 2

December 18, 2014
By
My Commonly Done ggplot2 graphs: Part 2

In my last post I described some of my commonly done ggplot2 graphs. It seems as though some people are interested in these, so I was going to follow this up with other plots I make frequently. Scatterplot colored by continuous variable The setup of the data for the scatterplots will be the same as

Read more »

My Commonly Done ggplot2 graphs

October 30, 2014
By
My Commonly Done ggplot2 graphs

In my last post, I discussed how ggplot2 is not always the answer to the question “How should I plot this” and that base graphics were still very useful. Why Do I use ggplot2 then? The overall question still remains: why (do I) use ggplot2? ggplot2 vs lattice For one, ggplot2 replaced the lattice package

Read more »

Working with NIfTI images in R

October 1, 2014
By
Working with NIfTI images in R

The oro.nifti package is awesome for NeuRoimaging (couldn't help myself). It has functions to read/write images, introduces the S4 nifti class, and has useful plotting functions. There are some limitations and some gotchas that are important to discuss if you are working with these objects in R. Dataset Creation We'll read in some data (a

Read more »

Sorted HTML Tables and Javascript Libraries

August 4, 2014
By
Sorted HTML Tables and Javascript Libraries

A few days ago StatsInTheWild asked the following question In the R function “sortable.html.table”, it's sorting 9.2 higher than 30.5 because of the leading digit. How do I fix this? — SITW (@StatsInTheWild) July 23, 2014 So we had a few exchanges where I thought you could use sprintf and be done but it didn't

Read more »

Sometimes Table is not the Answer – a Faster 2×2 Table

July 7, 2014
By
Sometimes Table is not the Answer – a Faster 2×2 Table

The table command is great in its simplicity for cross tabulations. I have run into some settings where it is slow and I wanted to demonstrate one simple example here of why you may want to use other functions or write your own tabler. This example is a specific case where, for some examples and

Read more »

R is a Language: Treat it Like One

June 30, 2014
By
R is a Language: Treat it Like One

I'm helping out with teaching a class on an introduction to R for students this week. I figured it'd be a good time to discuss my thoughts on programming in R and how a newcomer should feel about learning the language. Those Who Teach R, Should Use R Many of the students in the class

Read more »

Be Careful with Using Model Design in R

June 25, 2014
By
Be Careful with Using Model Design in R

In R, useful functions for making design matrices are model.frame and model.matrix. I will to discuss some of the differences of behavior across and within the two functions. I also have an example where I have run into this problme and it caused me to lose time. Using model.frame for a design matrix Whenever I

Read more »