Flicker frequency
flicker.Rd
An undesirable side-effect of some antihistamines is drowsiness, which is a consequence of the effect of the drugs on the central nervous system. These data come from an experiment to compare a placebo and two anti-histaminic drugs in their effect on the central nervous system. This can be done by measuring what is called the flicker frequency in volunteers who have taken the treatments. In the experiment there were 9 subjects, who each took one of the three treatments on each of three days. The experimental unit was thus a subject-day combination. The design of the experiment was based on three 3 x 3 latin squares in which the columns (days) are permuted randomly separately for each square, and the rows (subjects) are permuted using a random permutation of 1, 2, ... , 9. The three treatments are labelled A (meclastine, then a new anti-histaminic drug), B (placebo) and C (promethazine, an established anti-histaminic drug known to cause drowsiness).
Format
A data frame with 27 rows and 4 columns:
- subject
subject ID
- day
Day of the experiment
- frequency
Flicker frequency
- treatment
Anti-histaminic treatment given, one of
meclastine
,placebo
, orpromethazine
Source
Hedges, A., Hills, M., Maclay, W.P., Newman-Taylor, A.J. and Turner, P. (1971) Some central and peripheral effects of meclastine, a new antihistaminic drug, in man. Journal of Clinical Pharmacology, 2, 112-119
Examples
library(ggplot2)
library(patchwork)
#> Error in library(patchwork): there is no package called ‘patchwork’
library(hsds)
# Plot variation within days, treatments and subjects
## Days
p_days <- ggplot(flicker, aes(x = day, y = frequency)) +
geom_boxplot(color = "gray") +
geom_jitter(width = 0.1) +
theme_classic()
## Treatments
p_treat <- ggplot(flicker, aes(x = treatment, y = frequency)) +
geom_boxplot(color = "gray") +
geom_jitter(width = 0.1) +
theme_classic()
## Subjects
p_subj <- ggplot(flicker, aes(x = subject, y = frequency)) +
geom_boxplot(color = "gray") +
geom_jitter(width = 0.1) +
theme_classic()
# Combine using the `patchwork` package
p_days + p_treat + p_subj + plot_layout(nrow = 2)
#> Error in ggplot_add(object, p, objectname): Can't add `p_treat` to a <ggplot> object.
# Mixed model with random effects for day and subject
mod <- lmer(frequency ~ treatment + (1 | subject) + (1 | day), data = flicker)
# Plot of the marginal means per treatment, using the `modelbased` package
modelbased::estimate_means(mod, at = c("treatment")) |>
plot() +
theme_classic()
#> Error in loadNamespace(x): there is no package called ‘modelbased’
# Table of the contrast between treatments, using the `modelbased` package
modelbased::estimate_contrasts(mod, contrast = "treatment")
#> Error in loadNamespace(x): there is no package called ‘modelbased’