Blog Archives

Example 9.20: visualizing Simpson’s paradox

February 7, 2012
By
Example 9.20: visualizing Simpson’s paradox

Simpson's paradox is always amazing to explain to students. What's bad for one group, and bad for another group is good for everyone, if you just collapse over the grouping variable. Unlike many mathematical paradoxes, this arises in a number of real...

Read more »

Example 9.17: (much) better pairs plots

December 6, 2011
By
Example 9.17: (much) better pairs plots

Pairs plots (section 5.1.17) are a useful way of displaying the pairwise relations between variables in a dataset. But the default display is unsatisfactory when the variables aren't all continuous. In this entry, we discuss ways to improve these dis...

Read more »

Example 9.14: confidence intervals for logistic regression models

November 15, 2011
By
Example 9.14: confidence intervals for logistic regression models

Recently a student asked about the difference between confint() and confint.default() functions, both available in the MASS library to calculate confidence intervals from logistic regression models. The following example demonstrates that they yield d...

Read more »

Example 9.12: simpler ways to carry out permutation tests

October 31, 2011
By
Example 9.12: simpler ways to carry out permutation tests

In a previous entry, as well as section 2.4.3 of the book, we describe how to carry out a 2 group permutation test in SAS as well as with the coin package in R. We demonstrate with comparing the ages of the female and male subjects in the HELP study.I...

Read more »

Example 9.10: more regression trees and recursive partitioning with "partykit"

October 17, 2011
By
Example 9.10: more regression trees and recursive partitioning with "partykit"

We discuss recursive partitioning, a technique for classification and regression using a decision tree in section 6.7.3 of the book. Support for these methods is available within the rpart package. Torsten Hothorn and Achim Zeileis have extended the ...

Read more »

Example 9.9: Simplifying R using the mosaic package (part 1)

October 13, 2011
By
Example 9.9: Simplifying R using the mosaic package (part 1)

While both SAS and R are powerful systems for statistical analysis, they can be frustrating to new users or those learning statistics for the first time. RThe mosaic package is designed to help simplify the interface for such new users, while allowing ...

Read more »

Example 9.3: augmented display of contingency table

July 18, 2011
By
Example 9.3: augmented display of contingency table

SAS and R often provide different levels of details from output. This is particularly true for the descriptive analysis of contingency tables, where SAS makes it easy to display tables with additional quantities (such as the observed cell count).The m...

Read more »

Example 9.1: Scatterplots with binning for large datasets

July 5, 2011
By
Example 9.1: Scatterplots with binning for large datasets

Scatterplots can get very hard to interpret when displaying large datasets, as points inevitably overplot and can't be individually discerned. A number of approaches have been crafted to help with this problem. One approach uses binning. This approa...

Read more »

Example 8.42: skewness and kurtosis and more moments (oh my!)

June 27, 2011
By
Example 8.42: skewness and kurtosis and more moments (oh my!)

While skewness and kurtosis are not as often calculated and reported as mean and standard deviation, they can be useful at times. Skewness is the 3rd moment around the mean, and characterizes whether the distribution is symmetric (skewness=0). Kurtos...

Read more »

another look at CRAN Task Views

May 26, 2011
By
another look at CRAN Task Views

We've been impressed with how helpful the CRAN Task Views are in guiding us in R as we wend our way through the huge number of add-on packages (3021 as of May, 2011). These are web pages that are maintained by volunteers with expertise in a specified ...

Read more »