Lecture 22: Multilevel multinomial logistic model

Published

April 15, 2024

#label: load-packages-data
library(tidyverse)
library(knitr)
library(viridis)
library(broom.mixed)
library(mclogit)

inhaler <- read_csv("data/inhaler.csv")  |>
  mutate(rating = factor(rating), 
         treat = factor(treat), 
         period = factor(period))

Introduction

Today’s data come from an experiment in Ezzet and Whitehead (1991). The authors analyze data from a two-treatment, two-period crossover trial to compare 2 inhalation devices for delivering the drug salbutamol in 286 asthma patients. Patients were asked to rate the clarity of leaflet instructions accompanying each device, using a 4-point ordinal scale.1

We will use the following variables:

  • subject: The subject number
  • rating: The rating of the inhaler instructions on a scale ranging from 1 to 4
    • 1: easy to understand
    • 2: only clear after rereading
    • 3: not very clear
    • 4: confusing
  • treat: Indicator of which of the two inhaler devices was used
  • period: Indicator of whether the rating is from the first or second inhaler evaluated

The goal of the analysis is to understand which inhaler was easier for participants to understand.

Exploratory data analysis

Ex 1

Examine the distribution of the response variable rating. In general, what did the participants think about the instructions?

## add code here
Ex 2

Examine the relationship between rating and period. Does there appear to be an association between the order and what participants thought about the instructions?

## add code here
Ex 3

Examine the relationship between rating and treat. Does there appear to be an association between the inhaler used and what participants thought about the instructions?

## add code here

Model

Ex 4

We will fit a multinomial logistic model for multilevel data. We need a random effect for what term?

Form of the multilevel multinomial logistic model:

Let \(\pi_{ijk}\) be the probability of participant \(i\) selecting rating \(k\) in period \(j\)

\[\log\Big(\frac{\pi_{ijk}}{\pi_{ij1}}\Big) = \alpha_k + \beta_{1k}treat_{ij} + \beta_{2k}period_{ij} + u_{ik} \hspace{8mm} u_{ik} \sim N(0, \sigma^2_k)\]

Ex 5

Fit the model using the mblogit() function from the mclogit R package(Elff 2022).

## add code to fit and display model

Conclusions

Ex 6

Use the model to describe the effect of the order (period).

Ex 7

Use the model to describe the effect of the inhaler (treat)

References

Elff, Martin. 2022. “Mclogit: Multinomial Logit Models, with or Without Random Effects or Overdispersion.” https://CRAN.R-project.org/package=mclogit.
Ezzet, Farkad, and John Whitehead. 1991. “A Random Effects Model for Ordinal Responses from a Crossover Trial.” Statistics in Medicine 10 (6): 901–7. https://doi.org/10.1002/sim.4780100611.

Footnotes

  1. Experiment description from https://paul-buerkner.github.io/brms/reference/inhaler.html↩︎