Multiple Imputation with Diagnostics (mi) in R: Opening Windows into the Black Box

June 26, 2009
By

Our article (by Yu-Sung, Jennifer, Masanao, and myself, and based also on work with Kobi, Grazia, and Peter Messeri) will be appearing in the Journal of Statistical Software, in a special issue on missing-data imputation. Here's the abstract: ...

Read more »

Filtering cases

June 26, 2009
By
Filtering cases

Something that's very important to be able to do in data analysis and visualization is to filter out cases. Let's say you want to do identical analyses of two different groups, or of one group and then a subset of it. R can do this a little differently; instead of merely filtering out cases you can create an object...

Read more »

Filtering cases

June 26, 2009
By
Filtering cases

Something that's very important to be able to do in data analysis and visualization is to filter out cases. Let's say you want to do identical analyses of two different groups, or of one group and then a subset of it. R can do this a little differently; instead of merely filtering out cases you can create an object...

Read more »

Development of tikzDevice is underway

June 26, 2009
By

Development of the R package tikzDevice has been underway for about a month now. This package allows for the output of R graphics as TikZ commands. Charlie Sharpsteen and I have gotten it into an alpha stage. There is no real documentation but there is plenty of comments in the code. We have a R-forge

Read more »

Set the significant digits for each column in a xtable for fancy Sweave output

June 26, 2009
By
Set the significant digits for each column in a xtable for fancy Sweave output

This tip may be useful in the situations when you need to set the number of digits to print for the different columns in a matrix/data.frame to be outputted as a LaTeX table.  For example: #install.packages("xtable") #library(xtable) tmp <- m...

Read more »

A bit about linear models

June 26, 2009
By

Before we delve into slightly more advanced plotting commands I want to talk a little about linear models, specifically, linear regression. In R this is very, very simple. For instance, in our 'states' data frame, we might want to look at median household income as a predictor of state education expenditures. The command lm calculates this for us. We'll...

Read more »

A bit about linear models

June 26, 2009
By

Before we delve into slightly more advanced plotting commands I want to talk a little about linear models, specifically, linear regression. In R this is very, very simple. For instance, in our 'states' data frame, we might want to look at median household income as a predictor of state education expenditures. The command lm calculates this for us. We'll...

Read more »

Reading data, and a graph

June 25, 2009
By
Reading data, and a graph

Using Microsoft Excel I'm collecting aggregate data, by state, of various social, political, and economic indicators. I export them into a tab-delimited file called 'states.txt' (pretty clever, I know.) I've got data on education expenditures, firearm deaths per capita, median household income, etc. I'd like to do some analysis and graphing of these data to see if there are...

Read more »

Reading data, and a graph

June 25, 2009
By
Reading data, and a graph

Using Microsoft Excel I'm collecting aggregate data, by state, of various social, political, and economic indicators. I export them into a tab-delimited file called 'states.txt' (pretty clever, I know.) I've got data on education expenditures, firearm deaths per capita, median household income, etc. I'd like to do some analysis and graphing of these data to see if there are...

Read more »

Delete a List Component in R

June 24, 2009
By

In R, the way to delete a component in a list object is different from matrix and vector objects. For a vector, to delete an element:vec <- c(1, 2, 3)vec <- vecFor a matrix, to delete a row or a column:mat <- matrix(c(1,2,3,4), 2, 2)mat2 <- mat # delete a rowmat3 <- mat # delete a columnFor a list,...

Read more »

Delete a List Component in R

June 24, 2009
By

In R, the way to delete a component in a list object is different from matrix and vector objects. For a vector, to delete an element:vec <- c(1, 2, 3)vec <- vecFor a matrix, to delete a row or a column:mat <- matrix(c(1,2,3,4), 2, 2)mat2 <- mat # delete a rowmat3 <- mat # delete a columnFor a list,...

Read more »

A start

June 24, 2009
By

I've decided that this summer I will finally break down and force myself to learn a little bit about using R. I currently use Stata, a very good program, but the idea of R is appealing since it's free under the GNU license. It has a large and active us...

Read more »

A start

June 24, 2009
By

I've decided that this summer I will finally break down and force myself to learn a little bit about using R. I currently use Stata, a very good program, but the idea of R is appealing since it's free under the GNU license. It has a large and active us...

Read more »

Weekly R Clinic

June 24, 2009
By

For readers at Vanderbilt: At yesterday's R course I found out that Theresa Scott in the Biostatistics department holds a weekly R clinic and encourages new R users who want to learn more to bring any questions about R, or even your own code and data. The R clinic is held weekly on Thursday from 2:00-3:00 in MCN....

Read more »

Example 7.3: Simple jittered scatterplot with smoother for dichotomous outcomes with continuous predictors

June 24, 2009
By
Example 7.3: Simple jittered scatterplot with smoother for dichotomous outcomes with continuous predictors

It's useful to look at scatterplots even when the "y" variable is dichotomous. For example, this can help determine whether categorization or linear assumptions would be more plausible. However, an unmodified scatterplot is less than helpful, since all of the "y" values are either 0 or 1, and are hard to separate visually. Some jittering...

Read more »

Book now discounted 33% at Amazon!

June 24, 2009
By
Book now discounted 33% at Amazon!

Our book, SAS and R: Data Management, Statistical Analysis, and Graphics, is discounted by a full third at Amazon. With free shipping! Also, they claim if it is further discounted before it ships, they'll give you the reduced price.

Read more »

PDF tutorial from R course (Introduction to R)

June 23, 2009
By

Writing from the previously mentioned intro to R course at the Kennedy Center. If you couldn't make it you can download all the course materials from Theresa Scott's website, under the "Current Teaching Material" heading. Here is a direct link to the PDF for the overview materials that we're going over today, along with the R code...

Read more »

I had been wondering what impact my friending 200 people from my…

June 22, 2009
By
I had been wondering what impact my friending 200 people from my…

I had been wondering what impact my friending 200 people from my Gmail address book had, so I scraped the dates from the notification emails. The plot shows notifications of friend requests from other people to me in black and confirmations of my requests to other people in red. That sudden and sharp increase at...

Read more »

Who’s Tweets Do I Read… Magic R Code Says…

June 22, 2009
By
Who’s Tweets Do I Read… Magic R Code Says…

So one glace at my user logs shows the truth: no one gives a rat’s rump that I just quit my job; you just love you some Twitter R code. And I’m nothing but an attention whore, so come get some! So in my last ‘Twitter with R’ post I gave you some code I’d written

Read more »

Parallel computing in R: snowfall/snow

June 20, 2009
By

I finally have time to try parallel computing in R using snowfall/snow thanks to this article in the 1st issue of R journal, which replaces R news. I didn’t try it before because i didn’t have a good toy example, and it seemed like a steep learning curve (i only guessed what parallel computing was).

Read more »

Network Analysis Software: focus on F/OSS

June 20, 2009
By
Network Analysis Software: focus on F/OSS

What do you use for network analysis? I found the Wikipedia list of network software entirely overwhelming. I wanted to test out some of the introductory tools, but avoid the trap of sinking my time into a dead-end software project. (Remember learning Minitab in freshman statistics? How often do you use Minitab today for anything

Read more »

Analysis of Iran absentee votes

June 20, 2009
By
Analysis of Iran absentee votes

On http://www.presstv.com/detail.aspx?id=98206&sectionid=351020101 the official Iranian election results outside of Iran are posted. Here is a bit of exploration of the results.The graph shows the number of votes for Ahmadinejad (x-axis) vs. the nu...

Read more »

R: Function to create tables in LaTex or Lyx to display regression model results

June 19, 2009
By
R: Function to create tables in LaTex or Lyx to display regression model results

Most people using LaTex feel that creating tables is no fun. Some days ago I stumbled across a neat function written by Paul Johnson that produces LaTex code as well as LaTex code that can be used within Lyx. The output can be used for regression models and looks like output from the Stata outreg

Read more »

Iran Election analyzed with R

June 19, 2009
By
Iran Election analyzed with R

Here you can find a very interesting post depicting the R strengths in 'real-time statistics'. I'd like to use the occasion to thank David Smith for hosting the best, imho, blog on R!  Follow Him on Twitter: @revodavid .

Read more »

bugsparallel

June 18, 2009
By

bugsparallel is a Metrum Institute project to run BUGS (via R2WinBUGS) in parallel - McMC is an application, where parallel runs can be used very efficientlly. Here is the code for one example using bugsparallel.Some usefull links:Rosenthal, Parallel c...

Read more »

bugsparallel

June 18, 2009
By

bugsparallel is a Metrum Institute project to run BUGS (via R2WinBUGS) in parallel - McMC is an application, where parallel runs can be used very efficientlly. Here is the code for one example using bugsparallel.Some usefull links:Rosenthal, Parallel c...

Read more »

open-source campaign finance analysis with R and MySQL

June 18, 2009
By
open-source campaign finance analysis with R and MySQL

Introduction In Part 1 of this tutorial we introduced the fechell library by extracting all itemized contributions from individuals made to the Obama For America campaign in 2007 and 2008. In Part 2 of the tutorial we will summarize that data set by importing it into a MySQL database and aggregating contributions by week and

Read more »

The Second Coming

June 18, 2009
By

Pew Research has found that 79% of Americans believe in The Second Coming of Jesus. What worries me more is not that 4 out of 5 Americans believe in The Second Coming, but that 1 out of 5 believes it will happen in their lifetime. It seems inevitable that such a belief will grossly warp

Read more »

The Second Coming

June 18, 2009
By

Pew Research has found that 79% of Americans believe in The Second Coming of Jesus. What worries me more is not that 4 out of 5 Americans believe in The Second Coming, but that 1 out of 5 believes it will happen in their lifetime. It seems inevitable t...

Read more »