在使用R的mediation包时提醒:
Warning message:
In mediate(b, c, sims = 1000, treat = "x", :
treatment and control values do not match factor levels; using 1 and 2 as control and treatment, respectively
查了一下,在这个链接 里有人回应,是因为你的x变量的取值个数大于2(即非二分变量),同时代码并未声明对哪个特定取值进行分析
如果想对一个单独的取值进行分析,可以写:
med.out <- mediate(med.fit,
out.fit, treat = "deprinf", mediator = "estudic",
robustSE = TRUE, sims = 100,
control.value = "no", treat.value = "si")