Get startedGet started for free

Binomial data

1. Binomial data

Some data only has two outcomes; this data can be called binomial, like binary zeros and ones. Traditionally, one method to analyze this data was to calculate the proportion of "successes" or other similar variables. However, with a generalized linear model, we can directly model the zero or one outcome. These models are known as logistic regressions or probit analysis.

2. Examples of binomial data

Our world abounds with binary data. Did your coin toss land heads or tails? Will my team win or lose the game? Is the patient dead or alive after treatment? Do you like Star Wars? Do you like Star Trek? You likely have had many binary choices today already. GLMs allow us to model this binary data.

3. Binomial data with glmer

The syntax for fitting a generalized linear mixed effects model or generalized linear mixed effects regression (glmer) model is a combination of the lmer and a glm functions. We need to specify both a random effect and an error term. Note that unlike the glm() function, the glmer() function requires a non-Gaussian error term, otherwise we will get an error.

4. Dose-response case study

For our first case study, a toxicologist wonders if a chemical increases in toxicity as dose increases. Being a good scientist, she conducted her study in triplicate, that is, she had three replicates. However, because of this, she knows that she cannot use a generalized linear model, but needs a generalized linear mixed effects regression. During the exercise, we'll apply what we learned to help her by fitting this model.

5. Internet purchase

For our second case study, a client wonders if people purchase their products online. They have their data broken down into two columns, "Purchase" or "Pass". Also, each product is rated by customers on a 20 point scale with 0 being the lowest score and 20 the highest. Lastly, our client's customers can recommend products to their friends via social media. Our client wonders if recommendations from friends increase the chance that a customer will buy his product, so he tracked sales in four different cities.

6. Odds-ratio

Regression coefficients can be difficult to explain. Sometimes, odds-ratios can be easier. These are the odds that something will occur compared to something else. For example, if a group has an odds ratio of 2.0, then that group has two-to-one odds. These are often used to describe sporting events and medical studies. During the exercises, we'll extract the odds ratio from the marketing example.

7. Let's practice!

Time to use generalized linear mixed effects regressions!