When analysing binary outcomes, logistic regression is the analyst’s default approach for regression modelling. The logit link used in logistic regression is the so called canonical link function for the binomial distribution. Estimates from logistic regression are odds ratios, which measure how each predictor is estimated to increase the odds of a positive outcome, holding the other predictors constant. However, most people find risk ratios easier to interpret than odds ratios. In randomized studies it is of course easy to estimate the risk ratio comparing the two treatment (intervention) groups. With observational data, where the exposure or treatment is not randomly allocated, estimating the risk ratio for the effect of the treatment is somewhat trickier.

# Stata

## Why I think Stata’s old xi: prefix is still useful

A few versions ago Stata introduced a new facility for handling factor variables, which in many ways is superior to the older system, which was based on prefixing regression commands with xi:. But I actually think using this older xi: syntax can be useful in some situations, one of which is when trying to understand and learn about regression model specification.

## Stata-Mata’s st_view function – use with care!

I use Stata a lot, and I think it’s a great package. An excellent addition a few years ago was the Mata language, a fully fledged matrix programming language which sits on top or separate from Stata’s regular dataset and command/syntax structure. Many of Stata’s built in commands are programmed using Mata, I believe. I’ve been using Mata quite a bit to program new commands, and in the process have come across some strange behaviour in the st_view function in Mata which I think can cause real difficulties (it did for me!). This post will hopefully help avoid others ending up with the problems I did.