交互作用(効果修飾)グラフ

交互作用グラフテンプレート。サブグループ×効果量の交差する回帰直線。

interaction交互作用効果修飾subgroupサブグループ
交互作用(効果修飾)グラフ

R Code (ggplot2)

library(ggplot2)

# ---- Effect Modification (Interaction) Plot ----
# あなたのデータを入力してください
df <- data.frame(
  x = c(),
  y = c()
)

ggplot(df, aes(x = x, y = y)) +
  geom_point(size = 2) +
  geom_line() +
  scale_x_continuous(name = "Subgroup Variable", limits = c(0, 10)) +
  scale_y_continuous(name = "Treatment Effect", limits = c(-2, 5)) +
  labs(title = "Effect Modification (Interaction) Plot") +
  theme_bw(base_size = 14) +
  theme(plot.title = element_text(face = "bold", hjust = 0.5))