Bioequivalence and Crossover Analysis with sasLM

knitr::opts_chunk$set(comment = NA)
options(width = 100)
library(sasLM)

The standard 2x2 crossover analysis

Average bioequivalence with a 2x2 crossover design is conventionally analyzed with SAS PROC GLM:

PROC GLM DATA=be;
  CLASS SEQ SUBJ PRD TRT;
  MODEL LNCMAX = SEQ SUBJ(SEQ) PRD TRT;
  RANDOM SUBJ(SEQ) / TEST;
  LSMEANS TRT / CL ALPHA=0.1;
  ESTIMATE 'T - R' TRT -1 1 / CL ALPHA=0.1;
RUN;

The package ships BEdata, real data from a 2x2 bioequivalence study with three hospitalization groups. The same analysis with sasLM:

BEdata = af(BEdata, c("ADM", "SEQ", "PRD", "TRT", "SUBJ")) # columns as factors
formula1 = log(CMAX) ~ SEQ/SUBJ + PRD + TRT
GLM(formula1, BEdata)

SEQ/SUBJ denotes subjects nested within sequence, equivalent to SEQ SUBJ(SEQ) of SAS. The Type I, II, and III tables above match SAS PROC GLM for this unbalanced data set (91 subjects).

Testing SEQ against the correct error term

The sequence effect must be tested against the subject-within-sequence mean square, not the residual. This is what the RANDOM / TEST statement of SAS does:

RanTest(formula1, BEdata, Random="SUBJ")

The 90% confidence interval of the geometric mean ratio

The two-one-sided-tests (TOST) procedure at the 5% level is operationally the 90% confidence interval of T/R in the log scale:

ci0 = CIest(formula1, BEdata, "TRT", c(-1, 1), conf.level=0.90)
ci0
exp(ci0[, c("Estimate", "Lower CL", "Upper CL")]) # GMR and its 90% CI

The exponentiated estimate and confidence limits are the geometric mean ratio (GMR) and its 90% confidence interval. Bioequivalence is concluded when the interval is contained in [0.80, 1.25].

Least squares means of treatments

LSM(formula1, BEdata, "TRT", conf.level=0.90)

Notes



Try the sasLM package in your browser

Any scripts or data that you put into this service are public.

sasLM documentation built on July 14, 2026, 5:06 p.m.