Articles by Ken Kleinman

Example 8.40: Side-by-side histograms

June 13, 2011 | Ken Kleinman

It's often useful to compare histograms for some key variable, stratified by levels of some other variable. There are several ways to display something like this. The simplest may be to plot the two histograms in separate panels.SASIn SAS, the most d...
[Read more...]

Example 8.39: calculating Cramer’s V

June 3, 2011 | Ken Kleinman

Cramer's V is a measure of association for nominal variables. Effectively it is the Pearson chi-square statistic rescaled to have values between 0 and 1, as follows:V = sqrt(X^2 / [nobs * (min(ncols, nrows) - 1)])where X^2 is the Pearson chi-square, n...
[Read more...]

Example 8.31: Choropleth maps

March 22, 2011 | Ken Kleinman

In our book, we show a simple example of a map (section 6.4.2) where we read the boundary files as data sets and use SAS and R to plot them. But both SAS and R have complex functionality for using pre-compiled map data. To demonstrate them, we'll sho...
[Read more...]

Example 8.29: Risk ratios and odds ratios

March 7, 2011 | Ken Kleinman

When can you safely think of an odds ratio as being similar to a risk ratio?Many people find odds ratios hard to interpret, and thus would prefer to have risk ratios. In response to this, you can find several papers that purport to convert an odds rat...
[Read more...]

Example 8.18: A Monte Carlo experiment

December 13, 2010 | Ken Kleinman

In recent weeks, we've explored methods to fit logistic regression models when a state of quasi-complete separation exists. We considered Firth's penalized likelihood approach, exact logistic regression, and Bayesian models using Markov chain Monte Ca...
[Read more...]

Example 8.17: Logistic regression via MCMC

December 6, 2010 | Ken Kleinman

In examples 8.15 and 8.16 we considered Firth logistic regression and exact logistic regression as ways around the problem of separation, often encountered in logistic regression. (Re-cap: Separation happens when all the observations in a category sha...
[Read more...]

Example 8.16: Exact logistic regression

November 30, 2010 | Ken Kleinman

In example 8.15, on Firth logistic regression, we mentioned alternative approaches to separation troubles. Here we demonstrate exact logistic regression. The code for this appears in the book (section 4.1.2) but we don't show an example of it there. ...
[Read more...]

SAS and R joins SAS-x

November 29, 2010 | Ken Kleinman

Tal Galili, organizer of the R-bloggers blog aggregator, has opened a new aggregator for people blogging about SAS. If you're unfamiliar with the concept, an aggregator is a single blog which republishes (with permission, in this case) the entries fro...
[Read more...]

Example 8.15: Firth logistic regression

November 22, 2010 | Ken Kleinman

In logistic regression, when the outcome has low (or high) prevalence, or when there are several interacted categorical predictors, it can happen that for some combination of the predictors, all the observations have the same event status. A similar e...
[Read more...]

Example 8.13: Bike ride plot, part 2

November 8, 2010 | Ken Kleinman

Before explaining how to make and interpret the plot above, Nick and I want to make a plea for questions--it's hard to come up with useful questions to explore each week!As shown in Example 8.12, data from the Cyclemeter app can be used to make interes...
[Read more...]

Example 8.12: Bike ride plot, part 1

November 1, 2010 | Ken Kleinman

The iPhone app Cyclemeter uses the phone's GPS capability to record location and other data, and infer speed, while you ride. I took a ride near my house recently, and downloaded the data. I'd like to examine my route and my speed. A simple plot of ...
[Read more...]

Example 8.9: Contrasts

October 12, 2010 | Ken Kleinman

In example 8.6 we showed how to change the reference category. This is the natural first thought analysts have when their primary comparisons aren't represented in the default output. But our interest might center on a number of comparisons which don...
[Read more...]

Example 8.8: more Hosmer and Lemeshow

October 5, 2010 | Ken Kleinman

This is a special R-only entry.In Example 8.7, we showed the Hosmer and Lemeshow goodness-of-fit test. Today we demonstrate more advanced computational approaches for the test.If you write a function for your own use, it hardly matters what it looks l...
[Read more...]
1 2 3 4 5 6

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)