# Blog Archives

## another look at CRAN Task Views

May 26, 2011
By

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 ...

## Example 8.38: WriteXLS to create spreadsheets

May 16, 2011
By

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...

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

May 3, 2011
By

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...

## Example 8.36: Quadratic equation with real roots

April 29, 2011
By

We often simulate data in SAS or R to confirm analytical results. For example, consider the following problem from the excellent text by Rice:Let U1, U2, and U3 be independent random variables uniform on . What is the probability that the roots...

## Example 8.34: lack of robustness of t test with small n

April 12, 2011
By

Tim Hesterberg has effectively argued for a larger role for resampling based inference in introductory statistics courses (and statistical practice more generally). While the Central Limit Theorem is a glorious result, and the Student t-test remarkabl...

## Example 8.28: should we buy snowstorm insurance?

February 28, 2011
By

It's been a long winter so far in New England, with many a snow storm. In this entry, we consider a simulation to complement the analytic solution for a probability problem concerning snow. Consider a company that buys a policy to insure its revenue ...

## Example 8.27: using regular expressions to read data with variable number of words in a field

February 25, 2011
By

A more or less anonymous reader commented on our last post, where we were reading data from a file with a varying number of fields. The format of the file was:1 Las Vegas, NV --- 53.3 --- --- 12 Sacramento, CA --- 42.3 --- --- 2The complication in the...

## Example 8.26: reading data with variable number of words in a field

February 22, 2011
By

A student came with a question about how to snag data from a PDF report for analysis. Once she'd copied things her text file looked like:1 Las Vegas, NV --- 53.3 --- --- 12 Sacramento, CA --- 42.3 --- --- 23 Miami, FL --- 41.8 --- --- 34 Tucson, AZ --...

## Example 8.25: more latent class models (plus a graphical display)

February 15, 2011
By

In recent entries (here, here, here and here), we've been fitting a series of latent class models using SAS and R. One of the most commonly used and powerful package for latent class model estimation is Mplus. In this entry, we demonstrate how to use...

## Example 8.24: MplusAutomation and Mplus

February 7, 2011
By

In recent entries (here, here, and here), we've been fitting a series of latent class models using SAS and R. One of the most commonly used and powerful software package for latent class model estimation is Mplus. This commercial software includes su...