Let’s read in data from first 18 completers, only FCP, CRP, and outcome.
data <- read_excel('FitBIt_FCP_CRP_05-10-21.xlsx',
col_types = c("text","numeric","numeric","numeric","numeric","numeric","text","numeric","numeric","numeric")) %>%
mutate(success = case_when(status ==2 ~ 1, TRUE ~ 0))
## New names:
## * steroid_dose -> steroid_dose...4
## * steroid_dose -> steroid_dose...8
Going for a spaghetti plot by patient, with summary lines by group.
data %>%
ggplot(aes(x = visit, y = fcp,
col = factor(success), group = factor(sbj_id))) +
geom_line(size = 0.5, alpha = 0.3) +
geom_smooth(aes(group = factor(success)),
se = FALSE, method = "lm", size = 2) +
scale_color_manual(values = c("indianred1", "dodgerblue")) +
labs(y = "Fecal Calprotectin",
x = "Visit Number",
col = "Taper Success") +
theme_minimal(base_size = 14) +
theme(legend.position = c(0.75, 0.8))
## `geom_smooth()` using formula 'y ~ x'
Tiny difference in intercept for FCP, but slopes look the same for failure vs success of taper.
data %>%
ggplot(aes(x = visit, y = crp,
col = factor(success), group = factor(sbj_id))) +
geom_line(size = 0.5, alpha = 0.3) +
geom_smooth(aes(group = factor(success)),
se = FALSE, method = "lm", size = 2) +
scale_color_manual(values = c("indianred1", "dodgerblue")) +
labs(y = "C-Reactive Protein",
x = "Visit Number",
col = "Taper Success") +
theme_minimal(base_size = 14) +
theme(legend.position = c(0.75, 0.8))
## `geom_smooth()` using formula 'y ~ x'
Clearly different slopes for CRP in success vs failure of taper