マッチング手順の前後に共変量のバランスを視覚的に表示するために、次のコードを作成しました。
library(lattice)
library(gridExtra)
StandBias.df= data.frame(
Category= rep(c("A", "B", "C", "D", "E", "F"), 2),
Groups = factor(c(rep("0", 6), rep("1", 6))),
Values = c(0.26, 0.4, 0.3, 0.21, 0.6, 0.14, 0.12, -0.04, -0.23, 0.08, 0.14, -0.27))
d1<-dotplot(Category ~Values, data = StandBias.df, groups = Groups,
main = "Standardized Mean Differences", col = c("black", "grey50"), pch=c(22,15), xlab=NULL,
key=list(text=list(c("Pre-Matching", "Post-Matching")),
points=list(col = c("black", "grey50"), pch=c(22,15)),
space="bottom", border=T))
Ttest.df = data.frame(
Category= rep(c("A", "B", "C", "D", "E", "F"), 2),
Groups = factor(c(rep("0", 6), rep("1", 6))),
Values = c(0.12, 0.02, 0.69, 0.19, 0.05, 0.01, 0.62, 0.77, 0.54, 0.24, 0.92, 0.51))
d2<-dotplot(Category ~Values, data = Ttest.df, groups = Groups,
main = "p-values", col = c("black", "grey50"), pch=c(22,15), xlab=NULL,
key=list(text=list(c("Pre-Matching", "Post-Matching")),
points=list(col = c("black", "grey50"), pch=c(22,15)),
space="bottom", border=T))
grid.arrange(d1,d2,nrow=1)
問題: p 値 (d2) の 0.1 と [-0.25;] に垂直線を追加したいと思います。0.25] 標準化された平均値 (d1) に対して、バランスの取れた/バランスの取れていない視覚的なカットオフがあります。
これは私が試したことです:d1の場合、最後の行の後に次の行を追加しました。
...
space ="bottom", border=T),
panel=function(...){
panel.abline(v=0.25)
panel.abline(v=-0.25)}
)
変更されたコードは、要求された垂直線を含むプロットを生成しますが、データ ポイントは生成しません。
どんなアイデアでも大歓迎です!
どうもありがとう。