# \donttest{
data(apt)
fit <- fit_demand_fixed(apt, y_var = "y", x_var = "x", id_var = "id")
augmented <- augment(fit)
# Plot residuals by subject
library(ggplot2)
ggplot(augmented, aes(x = .fitted, y = .resid)) +
geom_point(alpha = 0.5) +
facet_wrap(~id) +
geom_hline(yintercept = 0, linetype = "dashed")
# }
Run the code above in your browser using DataLab