Blog Archives

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 »

Example 8.38: WriteXLS to create spreadsheets

May 16, 2011
By
Example 8.38: WriteXLS to create spreadsheets

In our last entry, we described reading Excel files. In this entry, we do the opposite: write native Excel files.RIn R, the WriteXLS package provides this functionality. It uses perl to do the heavy lifting, and the main complication is to install th...

Read more »

To attach() or not attach(): that is the question

May 3, 2011
By
To attach() or not attach(): that is the question

R objects that reside in other R objects can require a lot of typing to access. For example, to refer to a variable x in a dataframe df, one could type df$x. This is no problem when the dataframe and variable names are short, but can become burdensom...

Read more »