Follow

Statistics inside baseball. Read on if you want.

TIL that to fit a regression model for relative risk, you can use Poisson regression instead of the much finickier binomial regression with a log link. The first works on pretty much any reasonable data set. The second will fail about a quarter of the time, and it it works it will complain all the while.

Oh, and the relevant paper has been out for almost twenty years [1]. A five-year-old paper [2] shows that log-link binomial estimates *even when they work* are biased, while Poisson estimates aren't. As long as you use a robust variance estimator, the standard errors, and thus the p-values and confidence intervals, are nearly the same.

I've been tearing my hair out on this project trying to find a relative risk estimator that wouldn't choke on our data, and would execute in a reasonable amount of time for a large number of variables. Scouring software archives and statistical literature. Resigning myself to running warning- and crash-prone code, which I really dislike.

And the code for doing it the right way is *simple*.

`model = glm(reponse ~ predictor1 + predictor2, family=poisson)`

`library(sandwich)`

`library(lmtest)`

`coeftest(model, vcov=sandwich)`

Well. Live and learn.

[1] academic.oup.com/aje/article/1

[2] bmcmedresmethodol.biomedcentra

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.