Publications by Ken Kleinman

Example 8.9: Contrasts

12.10.2010

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’t share a category. Or we might need to compare one group with the mean of the...

809 sym 12 img

Example 8.12: Bike ride plot, part 1

01.11.2010

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 the route is trivial in either SAS or R, but adding the speed data requires a little work. ...

2556 sym Python (882 sym/4 pcs) 22 img

Example 8.13: Bike ride plot, part 2

08.11.2010

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 interesting plots of a bike ride. But in the previous application, questions remain. Why did my sp...

5653 sym R (2357 sym/6 pcs) 18 img

Example 8.15: Firth logistic regression

22.11.2010

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 event occurs when continuous covariates predict the outcome too perfectly.This phenom...

2890 sym R (1492 sym/5 pcs) 14 img

SAS and R joins SAS-x

29.11.2010

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 from many contributing blogs, gathering a dispersed community of interest to a single point in yo...

993 sym 14 img

Example 8.16: Exact logistic regression

30.11.2010

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. We’ll consider the setting of observing 100 subjects each with x=0 and x=1, obs...

2513 sym R (908 sym/4 pcs) 14 img

Example 8.17: Logistic regression via MCMC

06.12.2010

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 share a result, or when a continuous covariate predicts the outcome too well. It results in a like...

3440 sym R (2880 sym/5 pcs) 18 img

Example 8.18: A Monte Carlo experiment

13.12.2010

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 Carlo (MCMC).Today we’ll show how to build a Monte Carlo experiment to compare t...

5042 sym R (5261 sym/6 pcs) 14 img

Example 8.20: Referencing lists of variables, part 2

10.01.2011

In Example 8.19, we discussed how to refer to a group of variables with sequential names, such as varname1, varname2, varname3. This is trivial in SAS and can be done in R as we showed.It’s also sometimes useful to refer to all variables which begin with a common character string. For example, in the HELP data set, there are the v...

1929 sym R (649 sym/5 pcs) 14 img

Plug for RStudio: powerful, free, and easy to use interactive development environment for R

28.02.2011

(click for a bigger picture)As a longtime SAS user, one obstacle for me in using R professionally has been figuring out a process for saving and testing code across several work sessions and integrating code composition and execution. There are a couple of integrated R environments available, including ESS, TINN-R, and others. However, each of ...

3852 sym 16 img