Blog Archives

Example 2014.6: Comparing medians and the Wilcoxon rank-sum test

June 12, 2014
By
Example 2014.6: Comparing medians and the Wilcoxon rank-sum test

A colleague recently contacted us with the following question: "My outcome is skewed-- how can I compare medians across multiple categories?" What they were asking for was a generalization of the Wilcoxon rank-sum test (also known as the Mann-Whitney-Wilcoxon test, among other monikers) to more than two groups. For the record, the answer...

Read more »

Example 2014.5: Simple mean imputation

April 25, 2014
By
Example 2014.5: Simple mean imputation

We're both users of multiple imputation for missing data. We believe it is the most practical principled method for incorporating the most information into data analysis. In fact, one of our more successful collaborations is a review of software for ...

Read more »

Example 2014.4: Hilbert Matrix

April 14, 2014
By
Example 2014.4: Hilbert Matrix

Rick Wicklin showed how to make a Hilbert matrix in SAS/IML. Rick has a nice discussion of these matrices and why they might be interesting; the value of H_{r,c} is 1/(r+c-1). We show how to make this matrix in the data step and in R. We also show t...

Read more »

Example 2014.3: Allow different variances by group

February 27, 2014
By
Example 2014.3: Allow different variances by group

One common violation of the assumptions needed for linear regression is heterscedasticity by group membership. Both SAS and R can easily accommodate this setting. Our data today comes from a real example of vitamin D supplementation of milk. Four sup...

Read more »

Example 2014.2: Block randomization

January 22, 2014
By
Example 2014.2: Block randomization

This week I had to block-randomize some units. This is ordinarily the sort of thing I would do in SAS, just because it would be faster for me. But I had already started work on the project R, using knitr/LaTeX to make a PDF, so it made sense to continue the work in R. RAs is...

Read more »

Example 2014.1: "Power" for a binomial probability, plus: News!

January 14, 2014
By
Example 2014.1: "Power" for a binomial probability, plus: News!

Hello, folks! I'm pleased to report that Nick and I have turned in the manuscript for the second edition of SAS and R: Data Management, Statistical Analysis, and Graphics. It should be available this summer. New material includes some of our more po...

Read more »

Example 10.8: The upper 95% CI is 3.69

December 10, 2012
By
Example 10.8: The upper 95% CI is 3.69

Apologies for the long and unannounced break-- the longest since we started blogging, three and a half years ago. I was writing a 2-day course for SAS users to learn R. Contact me if you're interested. And Nick and I are beginning work on the second...

Read more »

Example 10.7: Fisher vs. Pearson

October 29, 2012
By
Example 10.7: Fisher vs. Pearson

In the early days of the discipline of statistics, R.A. Fisher argued with great vehemence against Egon Pearson (and Jerzy Neyman) over the foundational notions supporting statistical inference. The personal invective recorded is somewhat amusing an...

Read more »

Example 10.6: Should Poisson regression ever be used? Negative binomial vs. Poisson regression

October 15, 2012
By
Example 10.6: Should Poisson regression ever be used? Negative binomial vs. Poisson regression

In practice, we often find that count data is not well modeled by Poisson regression, though Poisson models are often presented as the natural approach for such data. In contrast, the negative binomial regression model is much more flexible and is therefore likely to fit better, if the data are not Poisson. In example 8.30 we...

Read more »

Example 10.5: Convert a character-valued categorical variable to numeric

October 8, 2012
By
Example 10.5: Convert a character-valued categorical variable to numeric

In some settings it may be necessary to recode a categorical variable with character values into a variable with numeric values. For example, the matching macro we discussed in example 7.35 will only match on numeric variables. One way to conve...

Read more »